Newer
Older
FROM ubuntu:xenial AS builder
# NOTE Customize the binary that is being built by providing `PROJECT` build-arg.
# E.g. docker build --build-arg PROJECT=ethereum-poa-relay ...
# show backtraces
ENV RUST_BACKTRACE 1
ENV LAST_DEPS_UPDATE 2020-06-22
# install tools and dependencies
RUN set -eux; \
apt-get update && \
apt-get install -y file curl jq ca-certificates && \
apt-get install -y cmake pkg-config libssl-dev git clang libclang-dev
ENV LAST_CERTS_UPDATE 2020-06-22
RUN update-ca-certificates && \
curl https://sh.rustup.rs -sSf | sh -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
ENV LAST_RUST_UPDATE 2020-09-09
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
RUN rustup update stable && \
rustup install nightly && \
rustup target add wasm32-unknown-unknown --toolchain nightly
RUN rustc -vV && \
cargo -V && \
gcc -v && \
g++ -v && \
cmake --version
WORKDIR /parity-bridges-common
### Build locally
ADD . /parity-bridges-common
ARG PROJECT=ethereum-poa-relay
RUN cargo build --release --verbose -p ${PROJECT}
RUN strip ./target/release/${PROJECT}
FROM ubuntu:xenial
# show backtraces
ENV RUST_BACKTRACE 1
RUN set -eux; \
apt-get update && \
apt-get install -y libssl-dev curl
RUN groupadd -g 1000 user \
&& useradd -u 1000 -g user -s /bin/sh -m user
# switch to non-root user
USER user
WORKDIR /home/user
ARG PROJECT=ethereum-poa-relay
COPY --chown=user:user --from=builder /parity-bridges-common/target/release/${PROJECT} ./
COPY --chown=user:user --from=builder /parity-bridges-common/deployments/scripts/bridge-entrypoint.sh ./
# check if executable works in this container
RUN ./${PROJECT} --version
ENV PROJECT=$PROJECT
ENTRYPOINT ["/home/user/bridge-entrypoint.sh"]