# Use: docker build . --pull --no-cache --shm-size=196m -t darkfi:almalinux -f ./contrib/docker/Dockerfile.almalinux --build-arg DONT_EXEC_TESTS=1 # optionally with: --build-arg OS_VER=almalinux/8-minimal --build-arg RUST_VER=nightly ARG RUST_VER=nightly-2023-06-21 # stable nightly beta 1.72 ARG OS_VER=almalinux/9-minimal # almalinux/8-minimal FROM ${OS_VER} as rust_builder ARG RUST_VER RUN microdnf -y install gcc gcc-c++ kernel-headers cmake jq wget \ pkg-config clang clang-libs llvm-libs \ openssl-devel findutils fontconfig-devel \ lato-fonts alsa-lib-devel python3-devel \ perl-FindBin perl-File-Compare perl-lib sqlite-devel \ perl-interpreter RUN curl https://sh.rustup.rs -sSf | bash -s -- -y --default-toolchain "${RUST_VER}" ENV PATH="/root/.cargo/bin:${PATH}" RUN rustup target add wasm32-unknown-unknown RUN cargo search whatever # creates .cargo cache # 2. stage FROM rust_builder as builder ARG DONT_EXEC_TESTS ARG RUST_VER WORKDIR /opt/darkfi COPY . /opt/darkfi RUN make clean RUN cargo update RUN rm -rf ./target/ zkas proof/*.bin RUN bash -c "if [ -z \"$DONT_EXEC_TESTS\" ]; then make -j test; fi" RUN bash -c 'make -j all' # 3. stage FROM ${OS_VER} RUN microdnf -y install openssl lato-fonts alsa-lib\ && microdnf clean all \ && rm -rf /var/cache/dnf WORKDIR /opt/darkfi COPY --from=builder /opt/darkfi/drk /opt/darkfi/darkfid \ /opt/darkfi/darkirc /opt/darkfi/faucetd \ /opt/darkfi/zkas /opt/darkfi/vanityaddr \ /opt/darkfi/tau /opt/darkfi/taud ./