Skip to content
Snippets Groups Projects
Commit ccc97e92 authored by Gilles Filippini's avatar Gilles Filippini
Browse files

build (docker): build only when no duniter binary

exists in the 'build' directory.

This allow to use this Dockerfile at CI time (where 'build/duniter' exists)
or for a full build from the source tree.
parent 2f87b413
No related branches found
No related tags found
1 merge request!7build: docker image and compose file
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
# with the image paritytech/ci-linux:production (currently based on # with the image paritytech/ci-linux:production (currently based on
# debian:buster-slim) used by the gitlab CI # debian:buster-slim) used by the gitlab CI
FROM rust:1-buster as build FROM rust:1-buster as build
WORKDIR /root
RUN apt-get update && \ RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \ DEBIAN_FRONTEND=noninteractive apt-get install -y \
...@@ -16,8 +17,13 @@ COPY . . ...@@ -16,8 +17,13 @@ COPY . .
# build duniter # build duniter
ARG threads=1 ARG threads=1
RUN CARGO_PROFILE_RELEASE_LTO="true" \ RUN test -x build/duniter || \
cargo build --release -j $threads ( \
CARGO_PROFILE_RELEASE_LTO="true" \
cargo build --release -j $threads && \
mkdir -p build && \
mv target/release/duniter build/ \
)
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Final Stage # Final Stage
...@@ -30,7 +36,7 @@ LABEL version="0.0.0" ...@@ -30,7 +36,7 @@ LABEL version="0.0.0"
LABEL description="Crypto-currency software (based on Substrate framework) to operate Ğ1 libre currency" LABEL description="Crypto-currency software (based on Substrate framework) to operate Ğ1 libre currency"
# Intall # Intall
COPY --from=build /target/release/duniter /usr/local/bin/duniter COPY --from=build /root/build/duniter /usr/local/bin/duniter
COPY docker/docker-entrypoint /usr/local/bin/ COPY docker/docker-entrypoint /usr/local/bin/
# Configuration # Configuration
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment