Dockerfile.debian 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. ARG RUST_VER=stable # stable; nightly; 1.77
  4. ARG OS_VER=bookworm-slim # (12); bullseye-slim (11); buster-slim (10)
  5. FROM debian:${OS_VER} as rust_builder
  6. ARG RUST_VER
  7. RUN apt-get update && apt-get install -y build-essential cmake jq wget \
  8. pkg-config clang libclang-dev llvm-dev libudev-dev libfreetype6-dev libasound2-dev \
  9. libexpat1-dev curl gcc make libssl-dev fonts-lato libfontconfig-dev python3-dev libsqlite3-dev \
  10. libsqlcipher-dev
  11. RUN curl https://sh.rustup.rs -sSf | bash -s -- -y --default-toolchain "${RUST_VER}"
  12. ENV PATH="/root/.cargo/bin:${PATH}"
  13. RUN rustup target add wasm32-unknown-unknown
  14. RUN cargo search whatever # creates .cargo cache
  15. # 2. stage
  16. FROM rust_builder as builder
  17. ARG DONT_EXEC_TESTS
  18. ARG RUST_VER
  19. WORKDIR /opt/darkfi
  20. COPY . /opt/darkfi
  21. RUN make clean
  22. RUN cargo update
  23. RUN rm -rf ./target/ zkas proof/*.bin
  24. RUN bash -c "if [ -z \"$DONT_EXEC_TESTS\" ]; then make -j test; fi"
  25. RUN bash -c 'make -j all'
  26. # 3. stage
  27. FROM debian:${OS_VER}
  28. RUN apt-get -y update && apt-get install -y openssl fonts-lato libout123-0 libmpg123-0 libasound2 libsqlite3-0 \
  29. && apt-get clean && rm -rf /var/lib/apt/lists/*
  30. WORKDIR /opt/darkfi
  31. COPY --from=builder /opt/darkfi/drk /opt/darkfi/darkfid \
  32. /opt/darkfi/darkirc \
  33. /opt/darkfi/zkas /opt/darkfi/vanityaddr \
  34. /opt/darkfi/taud ./