-
Notifications
You must be signed in to change notification settings - Fork 35
/
Dockerfile.release
45 lines (31 loc) · 1.25 KB
/
Dockerfile.release
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
FROM docker.io/paritytech/ci-linux:production as builder
LABEL description="This is the build stage for Parallel. Here we create the binary."
ARG PROFILE=production
ARG BIN=parallel
WORKDIR /parallel
COPY . /parallel
RUN rustup default nightly
RUN cargo build --workspace --exclude runtime-integration-tests --profile $PROFILE --bin $BIN --features runtime-benchmarks --features try-runtime
# ===== SECOND STAGE ======
FROM docker.io/library/ubuntu:20.04
ENV DEBIAN_FRONTEND=noninteractive
LABEL description="This is the 2nd stage: a very small image where we copy the Parallel binary."
ARG PROFILE=production
ARG BIN=parallel
ENV BIN_PATH=/usr/local/bin/$BIN
COPY --from=builder /parallel/target/$PROFILE/$BIN /usr/local/bin
RUN apt update -y \
&& apt install -y ca-certificates libssl-dev tzdata \
&& useradd -m -u 1000 -U -s /bin/sh -d /parallel parallel \
&& mkdir -p /parallel/.local \
&& mkdir /data \
&& chown -R parallel:parallel /data \
&& ln -s /data /parallel/.local/share \
&& chown -R parallel:parallel /parallel/.local/share
USER parallel
WORKDIR /parallel
EXPOSE 30333 9933 9944 29933
VOLUME ["/data"]
RUN echo '#!/bin/bash\n$BIN_PATH $@' > .entrypoint.sh
RUN chmod u+x .entrypoint.sh
ENTRYPOINT ["/parallel/.entrypoint.sh"]