forked from MinixChain/MinixChain
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.prod
45 lines (31 loc) · 1.25 KB
/
Dockerfile.prod
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 phusion/baseimage:0.11 as builder
LABEL description="The build stage for MinixChain. We create the MinixChain binary in this stage."
ARG PROFILE=release
ARG APP=minix
ARG RUSTC_VERSION=nightly-2021-03-24
WORKDIR /$APP
COPY . /$APP
RUN apt-get update && \
apt-get -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" dist-upgrade -y && \
apt-get install -y cmake pkg-config libssl-dev git clang
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y && \
export PATH=$PATH:$HOME/.cargo/bin && \
rustup toolchain install $RUSTC_VERSION && \
rustup target add wasm32-unknown-unknown --toolchain $RUSTC_VERSION && \
cargo +$RUSTC_VERSION build --$PROFILE
# ===== SECOND STAGE ======
FROM phusion/baseimage:0.11
LABEL description="A very small image where we copy the MinixChain binary created from the builder image."
ARG PROFILE=release
ARG APP=minix
COPY --from=builder /$APP/target/$PROFILE/$APP /usr/local/bin
RUN mv /usr/share/ca* /tmp && \
rm -rf /usr/share/* && \
mv /tmp/ca-certificates /usr/share/ && \
rm -rf /usr/lib/python* && \
mkdir -p /root/.local/share/ && \
ln -s /root/.local/share/minix /data
RUN rm -rf /usr/bin /usr/sbin
EXPOSE 9999 8888
VOLUME ["/data"]
CMD ["/usr/local/bin/minix"]