Browse Source

multistage dockerfile

Mokhtar Naamani 5 years ago
parent
commit
063a4cf636
1 changed files with 18 additions and 14 deletions
  1. 18 14
      Dockerfile

+ 18 - 14
Dockerfile

@@ -1,22 +1,26 @@
-FROM liuchong/rustup:1.41.1 AS builder
-LABEL description="Joystream substrate node"
+FROM joystream/rust-builder AS node-build
+LABEL description="Compiles joystream substrate node"
 
 WORKDIR /joystream
+# if source files change will the intermediate image be rebuilt?
 COPY . /joystream
 ENV TERM=xterm
 
-RUN apt-get update && apt-get install git clang -y \
-    && ./setup.sh \
-    && cargo build --release \
-    && cp ./target/release/joystream-node . \
-    && cargo clean \
-    && rm -fr target \
-    && rm -fr ~/.cargo \
-    && rm -fr ~/.rustup \
-    && apt-get remove git clang -y \
-    && rm -fr /var/lib/apt/lists/*
+RUN cargo build --release
 
-VOLUME ["/data", "/keystore"]
+FROM debian:stretch
+LABEL description="Joystream node"
+
+WORKDIR /joystream
+ENV TERM=xterm
+
+COPY --from=node-build /joystream/target/release/joystream-node /joystream
 
-ENTRYPOINT ["/joystream/joystream-node"]
+# Use these volumes to persits chain state and keystore, eg.:
+# --base-path /data
+# optionally separate keystore (otherwise it will be stored in the base path)
+# --keystore-path /keystore
+# if basepath isn't specified it will be inside container in ~/.local/share/joystream-node/
+VOLUME ["/data", "/keystore"]
 
+ENTRYPOINT ["/joystream/joystream-node"]