Skip to content

Commit

Permalink
Production stage of Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
Ujang360 committed Mar 20, 2020
1 parent 44ed7e6 commit 86b9213
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 22 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**/target
46 changes: 26 additions & 20 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,42 +1,48 @@
# Stage 1 - Build

FROM golang:1.14-buster as builder
FROM bitwyre/native-builder:latest as builder
WORKDIR /app/parity

COPY go-ethereum /app/src/go-ethereum
WORKDIR /app/src/go-ethereum
# YASM
COPY yasm yasm
RUN cd yasm && \
./autogen.sh && \
./configure && \
make -j4 install

RUN apt-get update && apt-get install -y build-essential
RUN echo "\nSubmodule files:"&& \
ls -Falg --group-directories-first && \
echo && \
gcc --version && \
make -j$(nproc) geth
RUN cd /app/src/go-ethereum/build && \
ls -Falg --group-directories-first && \
strip bin/geth
# Open-Ethereum
COPY openethereum openethereum
WORKDIR /app/parity/openethereum
ENV PATH /root/.cargo/bin:/usr/lib/llvm-10/bin:$PATH
RUN RUSTFLAGS="-C link-args=-s -C codegen-units=1" cargo build --release --features final && \
echo "\nBinary info:" && file target/release/parity && size target/release/parity


# Stage 2 - Production Image

FROM ubuntu:18.04

LABEL maintainer "Yefta Sutanto <[email protected]>"
LABEL maintainer "Yefta Sutanto ([email protected]), Aditya Kresna ([email protected])"

RUN apt-get update && \
apt-get install -y --no-install-recommends gosu && \
rm -rf /var/lib/apt/lists/* && \
groupadd -r ethereum && useradd -r -m -g ethereum ethereum
RUN mkdir -p /home/ethereum/.ethereum && \
RUN mkdir -p /home/ethereum/.local/share/io.parity.ethereum && \
chown -R ethereum:ethereum /home/ethereum

COPY --from=builder /app/src/go-ethereum/build/bin /usr/local/bin
COPY --from=builder /app/parity/openethereum/target/release/parity /usr/local/bin/parity
COPY testnet-config.toml /home/ethereum/.local/share/io.parity.ethereum/config.toml
COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh

VOLUME ["/home/ethereum/.ethereum"]
EXPOSE 8545 8546 8547 30303 30303/udp
RUN chmod +x /docker-entrypoint.sh && \
# Take ownership once again
chown -R ethereum:ethereum /home/ethereum

VOLUME ["/home/ethereum/.local/share/io.parity.ethereum"]
EXPOSE 8082 8083 8545 8546 8547 30303 30303/udp

ENV ETHEREUM_DATA "/home/ethereum/.ethereum"
ENV ETHEREUM_DATA "/home/ethereum/.local/share/io.parity.ethereum"

ENTRYPOINT ["/./docker-entrypoint.sh"]
CMD ["geth"]
CMD ["parity"]
15 changes: 13 additions & 2 deletions testnet-config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,24 @@ min_peers = 5
cors = ["*"]
# Allow connections only using specified addresses.
hosts = ["*"]
# Only selected APIs will be exposed over this interface.
apis = [
"web3", "eth", "pubsub", "net", "parity", "private", "parity_pubsub", "traces", "rpc", "shh", "shh_pubsub",
"parity_transactions_pool", "personal", "parity_accounts", "secretstore"
]
# Threads for handling incoming connections for HTTP JSON-RPC server.
server_threads = 2

[websockets]
# Only selected APIs will be exposed over this interface.
apis = ["web3", "eth", "pubsub", "net", "parity", "parity_pubsub", "private", "traces", "rpc", "shh", "shh_pubsub", "parity_transactions_pool", "personal", "parity_accounts", "secretstore"]
apis = [
"web3", "eth", "pubsub", "net", "parity", "parity_pubsub", "private", "traces", "rpc", "shh", "shh_pubsub",
"parity_transactions_pool", "personal", "parity_accounts", "secretstore"
]

[ipc]
# Only selected APIs will be exposed over this interface.
apis = ["web3", "eth", "pubsub", "net", "parity", "parity_pubsub", "parity_accounts", "private", "traces", "rpc", "shh", "shh_pubsub", "parity_transactions_pool", "personal", "secretstore"]
apis = [
"web3", "eth", "pubsub", "net", "parity", "parity_pubsub", "parity_accounts", "private", "traces", "rpc", "shh",
"shh_pubsub", "parity_transactions_pool", "personal", "secretstore"
]

0 comments on commit 86b9213

Please sign in to comment.