Dockerfile.ubuntuARMviaEmulation 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. # Beware, uses emulation, with AMD 24 threads: Building 6047.7s
  2. # Use: docker build . --platform=linux/arm64 --pull -t darkfi:ubuntu_arm64 -f contrib/docker/Dockerfile.ubuntuARMviaEmulation --build-arg DONT_EXEC_TESTS=1
  3. # optionally with: --build-arg BUILD_OS_VER=20.04 --build-arg RUST_VER=1.70
  4. ARG RUST_VER=nightly-2023-06-21 # stable nightly beta 1.72
  5. ARG OS_VER=22.04 # 20.04
  6. FROM --platform=$TARGETPLATFORM ubuntu:${OS_VER} as rust_builder
  7. ARG TARGETPLATFORM
  8. ARG BUILDPLATFORM
  9. ARG RUST_VER
  10. RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM"
  11. RUN apt-get update && DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install -y \
  12. build-essential cmake jq wget curl \
  13. pkg-config clang libclang-dev llvm-dev libudev-dev libfreetype6-dev \
  14. libexpat1-dev curl gcc make libssl-dev fonts-lato libfontconfig-dev \
  15. libasound2-dev python3-dev libsqlite3-dev
  16. RUN curl https://sh.rustup.rs -sSf | bash -s -- -y --default-toolchain "${RUST_VER}"
  17. ENV PATH="/root/.cargo/bin:${PATH}"
  18. RUN rustup target add wasm32-unknown-unknown
  19. RUN rustup target add aarch64-unknown-linux-gnu
  20. RUN cargo search whatever # creates .cargo cache
  21. RUN cargo install -f cross
  22. # 2. stage
  23. FROM --platform=$TARGETPLATFORM rust_builder as builder
  24. ARG DONT_EXEC_TESTS
  25. ARG RUST_VER
  26. WORKDIR /opt/darkfi
  27. COPY . /opt/darkfi
  28. RUN cargo update
  29. RUN make clean
  30. RUN rm -rf ./target/ zkas proof/*.bin
  31. RUN bash -c "if [ -z \"$DONT_EXEC_TESTS\" ]; then make -j test; fi"
  32. RUN bash -c 'make -j all'
  33. # 3. stage
  34. FROM --platform=$TARGETPLATFORM ubuntu:${OS_VER}
  35. RUN apt-get -y update && apt-get install -y openssl fonts-lato libout123-0 libmpg123-0 libasound2 libsqlite3-0 \
  36. && apt-get clean && rm -rf /var/lib/apt/lists/*
  37. WORKDIR /opt/darkfi
  38. COPY --from=builder /opt/darkfi/drk /opt/darkfi/darkfid \
  39. /opt/darkfi/darkirc /opt/darkfi/faucetd \
  40. /opt/darkfi/zkas /opt/darkfi/vanityaddr \
  41. /opt/darkfi/tau /opt/darkfi/taud ./