Dockerfile.debian
1 # Use: docker build . --pull --no-cache --shm-size=196m -t darkfi:debian -f ./contrib/docker/Dockerfile.debian --build-arg DONT_EXEC_TESTS=1 2 # optionally with: --build-arg OS_VER=bullseye-slim --build-arg RUST_VER=nightly 3 4 ARG RUST_VER=stable # stable; nightly; 1.77 5 ARG OS_VER=bookworm-slim # (12); bullseye-slim (11); buster-slim (10) 6 7 FROM debian:${OS_VER} as rust_builder 8 9 ARG RUST_VER 10 11 RUN apt-get update && apt-get install -y build-essential cmake jq wget \ 12 pkg-config clang libclang-dev llvm-dev libudev-dev libfreetype6-dev libasound2-dev \ 13 libexpat1-dev curl gcc make libssl-dev fonts-lato libfontconfig-dev python3-dev libsqlite3-dev \ 14 libsqlcipher-dev wabt 15 16 RUN curl https://sh.rustup.rs -sSf | bash -s -- -y --default-toolchain "${RUST_VER}" 17 18 ENV PATH="/root/.cargo/bin:${PATH}" 19 20 RUN rustup target add wasm32-unknown-unknown 21 22 RUN cargo search whatever # creates .cargo cache 23 24 # 2. stage 25 FROM rust_builder as builder 26 27 ARG DONT_EXEC_TESTS 28 ARG RUST_VER 29 30 WORKDIR /opt/darkfi 31 32 COPY . /opt/darkfi 33 34 RUN make clean 35 36 RUN cargo update 37 38 RUN rm -rf ./target/ zkas proof/*.bin 39 40 RUN bash -c "if [ -z \"$DONT_EXEC_TESTS\" ]; then make -j test; fi" 41 42 RUN bash -c 'make -j all' 43 44 # 3. stage 45 FROM debian:${OS_VER} 46 47 RUN apt-get -y update && apt-get install -y openssl fonts-lato libout123-0 libmpg123-0 libasound2 libsqlite3-0 \ 48 && apt-get clean && rm -rf /var/lib/apt/lists/* 49 50 WORKDIR /opt/darkfi 51 52 COPY --from=builder /opt/darkfi/drk /opt/darkfi/darkfid \ 53 /opt/darkfi/darkirc \ 54 /opt/darkfi/zkas /opt/darkfi/vanityaddr \ 55 /opt/darkfi/taud ./