Skip to content

Commit 5fd225c

Browse files
fix dockerfile
1 parent 30c7041 commit 5fd225c

File tree

2 files changed

+61
-0
lines changed

2 files changed

+61
-0
lines changed

.dockerignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
**/target
2+
cli-tool
3+
ct_scripts
4+
k8s

Dockerfile

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Note: We don't use Alpine and its packaged Rust/Cargo because they're too often out of date,
2+
# preventing them from being used to build Substrate/Polkadot.
3+
4+
FROM phusion/baseimage:0.11 as builder
5+
LABEL maintainer="dylan@threefold.tech"
6+
LABEL description="This is the build stage for the tfchain substrate node binary."
7+
8+
ENV DEBIAN_FRONTEND=noninteractive
9+
10+
WORKDIR /tfchain
11+
12+
13+
RUN apt-get update && \
14+
apt-get dist-upgrade -y -o Dpkg::Options::="--force-confold" && \
15+
apt-get install -y cmake pkg-config libssl-dev git clang
16+
17+
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y && \
18+
export PATH="$PATH:$HOME/.cargo/bin" && \
19+
rustup install nightly && \
20+
rustup target add wasm32-unknown-unknown --toolchain nightly && \
21+
rustup default stable
22+
23+
24+
ARG PROFILE=release
25+
COPY substrate-node/ /tfchain
26+
COPY pallets/ /tfchain
27+
28+
RUN export PATH="$PATH:$HOME/.cargo/bin" && \
29+
cargo build "--$PROFILE"
30+
31+
# ===== SECOND STAGE ======
32+
33+
FROM phusion/baseimage:0.11
34+
LABEL maintainer="dylan@threefold.tech"
35+
LABEL description="This is the 2nd stage: a very small image where we copy the tfchain binary."
36+
ARG PROFILE=release
37+
38+
RUN rm -rf /usr/share/* && \
39+
mkdir -p /tfchain/.local
40+
41+
COPY --from=builder /tfchain/target/$PROFILE/tfchain /usr/local/bin
42+
COPY chainspecs /etc/chainspecs/
43+
44+
45+
# checks
46+
RUN ldd /usr/local/bin/tfchain && \
47+
/usr/local/bin/tfchain --version
48+
49+
# Shrinking
50+
RUN rm -rf /usr/lib/python* && \
51+
rm -rf /usr/bin /usr/sbin /usr/share/man && \
52+
rm -rf /src
53+
54+
EXPOSE 30333 9933 9944 9615
55+
VOLUME ["/tfchain"]
56+
57+
ENTRYPOINT ["/usr/local/bin/tfchain"]

0 commit comments

Comments
 (0)