Add Dockerfile for ARM64 build, builds OK, but is slooooow, not tested

This commit is contained in:
spital
2023-02-21 15:59:27 +01:00
committed by parazyd
parent 2cf229eebb
commit 24567c545a

View File

@@ -0,0 +1,55 @@
# Beware, uses emulation, with AMD 24 threads: Building 6047.7s
# Use: docker build . --platform=linux/arm64 --pull -t darkfi:ubuntu_arm64 -f contrib/docker/Dockerfile.ubuntuARMviaEmulation
# optionally with: --build-arg BUILD_OS_VER=20.04 --build-arg RUST_VER=1.65
ARG RUST_VER=1.67 # stable nightly beta
ARG BUILD_OS_VER=22.04 # 20.04
ARG RUN_OS_VER=${BUILD_OS_VER}
ARG REPOSITORY=ubuntu
FROM --platform=$TARGETPLATFORM ${REPOSITORY}:${BUILD_OS_VER} as rust_builder
ARG TARGETPLATFORM
ARG BUILDPLATFORM
ARG RUST_VER
RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM"
RUN apt-get update && DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install -y \
build-essential cmake jq wget curl \
pkg-config clang libclang-dev llvm-dev libudev-dev libfreetype6-dev \
libexpat1-dev curl gcc make libssl-dev fonts-lato libfontconfig-dev
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 rustup target add aarch64-unknown-linux-gnu
RUN cargo search whatever # creates .cargo cache
RUN cargo install -f cross
# 2. stage
FROM --platform=$TARGETPLATFORM rust_builder as builder
WORKDIR /opt/darkfi
COPY . /opt/darkfi
RUN make clean
RUN rm -rf ./target/*
RUN bash -c 'make -j test && make -j all'
# 3. stage
FROM --platform=$TARGETPLATFORM ${REPOSITORY}:${RUN_OS_VER}
RUN apt-get -y update && apt-get install -y openssl fonts-lato \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
WORKDIR /opt/darkfi
COPY --from=builder /opt/darkfi/drk /opt/darkfi/darkfid \
/opt/darkfi/ircd /opt/darkfi/dnetview /opt/darkfi/faucetd \
/opt/darkfi/zkas /opt/darkfi/vanityaddr ./