Dockerfile.almalinux and fix builds, latest working b36861fa1d_2023-06-13 (#183)

* Dockerfile.almalinux and fix builds, latest working b36861fa1d_2023-06-13

* Docker build can skip tests, add runtime deps

* update Fedora and Almalinux dockerfiles, worked for 95d0f47_2023-08-11 with "--build-arg DONT_EXEC_TESTS=1 --build-arg RUST_VER=nightly"

---------

Co-authored-by: parazyd <parazyd@dyne.org>
This commit is contained in:
spital
2023-08-30 07:57:33 +02:00
committed by GitHub
parent 2a67711868
commit 2536a46aaa
9 changed files with 200 additions and 84 deletions

3
.dockerignore Normal file
View File

@@ -0,0 +1,3 @@
**/target/
**/.git
**/*.zk.bin

View File

@@ -0,0 +1,58 @@
# 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 ./

View File

@@ -1,8 +1,8 @@
# Use: docker build . --pull --network=host -t darkfi:alpine -f ./contrib/docker/Dockerfile.alpine
# Use: docker build . --pull --no-cache --shm-size=196m -t darkfi:alpine -f ./contrib/docker/Dockerfile.alpine --build-arg DONT_EXEC_TESTS=1
# optionally with: --build-arg ALPINE_VER=3.18 --build-arg RUST_VER=nightly
ARG RUST_VER=1.70 # 1.67
ARG ALPINE_VER=3.18 # 3.17
ARG RUST_VER=nightly-2023-06-21 # 1.72 nightly stable
ARG ALPINE_VER=3.18 # 3.17
FROM alpine:${ALPINE_VER} as rust_builder
@@ -14,38 +14,47 @@ RUN apk update
RUN apk add cmake jq wget clang curl gcc make llvm-dev \
openssl-dev expat-dev freetype-dev libudev-zero-dev \
libgudev-dev pkgconf clang-dev fontconfig-dev bash \
ttf-opensans musl-dev alsa-lib-dev
ttf-opensans musl-dev alsa-lib-dev python3-dev perl sqlite-dev
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y --default-toolchain "${RUST_VER}" --default-host x86_64-unknown-linux-musl
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y --default-toolchain "${RUST_VER}" --default-host $(uname -m)-unknown-linux-musl
ENV PATH="/root/.cargo/bin:${PATH}"
RUN rustup target add wasm32-unknown-unknown
RUN cargo search whatever # creates .cargo cache
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 . ./
ARG RUSTFLAGS="-C target-feature=-crt-static"
RUN cargo update
RUN make clean
RUN rm -rf ./target/
RUN rm -rf ./target/ zkas proof/*.bin
RUN bash -c 'make -j test && make -j'
RUN bash -c "if [ -z \"$DONT_EXEC_TESTS\" ]; then make -j test; fi"
RUN bash -c 'make -j all'
# 3. stage
FROM alpine:${ALPINE_VER}
RUN apk add --no-cache openssl ttf-opensans libgcc
RUN apk add --no-cache openssl ttf-opensans libgcc alsa-lib sqlite-libs
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 ./
/opt/darkfi/darkirc /opt/darkfi/faucetd \
/opt/darkfi/zkas /opt/darkfi/vanityaddr \
/opt/darkfi/tau /opt/darkfi/taud ./

View File

@@ -1,9 +1,9 @@
# Beware, uses emulation, with AMD 24 threads: Building 7788.3s
# Use: docker build . --platform=linux/arm64 --pull -t darkfi:alpine_arm64 -f ./contrib/docker/Dockerfile.alpineARMviaEmulation
# Use: docker build . --platform=linux/arm64 --pull -t darkfi:alpine_arm64 -f ./contrib/docker/Dockerfile.alpineARMviaEmulation --build-arg DONT_EXEC_TESTS=1
# optionally with: --build-arg OS_VER=3.18 --build-arg RUST_VER=nightly
ARG RUST_VER=1.70 # 1.67
ARG OS_VER=3.18 # 3.17
ARG RUST_VER=nightly-2023-06-21 # 1.72 beta stable nightly
ARG OS_VER=3.18 # 3.17
ARG REPOSITORY=arm64v8/alpine
FROM --platform=$TARGETPLATFORM ${REPOSITORY}:${OS_VER} as rust_builder
@@ -19,9 +19,9 @@ RUN apk update
RUN apk add cmake jq wget clang curl gcc make llvm-dev \
openssl-dev expat-dev freetype-dev libudev-zero-dev \
libgudev-dev pkgconf clang-dev fontconfig-dev bash \
ttf-opensans musl-dev alsa-lib-dev
ttf-opensans musl-dev alsa-lib-dev python3-dev perl sqlite-dev
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y --default-toolchain "${RUST_VER}"
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y --default-toolchain "${RUST_VER}" --default-host $(uname -m)-unknown-linux-musl
ENV PATH="/root/.cargo/bin:${PATH}"
@@ -32,25 +32,34 @@ RUN cargo search whatever # creates .cargo cache
# 2. stage
FROM --platform=$TARGETPLATFORM rust_builder as builder
ARG DONT_EXEC_TESTS
ARG RUST_VER
WORKDIR /opt/darkfi
COPY . ./
ARG RUSTFLAGS="-C target-feature=-crt-static"
RUN cargo update
RUN make clean
RUN rm -rf ./target/
RUN rm -rf ./target/ zkas proof/*.bin
RUN bash -c 'make -j test && make -j'
RUN bash -c "if [ -z \"$DONT_EXEC_TESTS\" ]; then make -j test; fi"
RUN bash -c 'make -j all'
# 3. stage
FROM --platform=$TARGETPLATFORM ${REPOSITORY}:${OS_VER}
RUN apk add --no-cache openssl ttf-opensans libgcc
RUN apk add --no-cache openssl ttf-opensans libgcc alsa-lib sqlite-libs
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 ./
/opt/darkfi/darkirc /opt/darkfi/faucetd \
/opt/darkfi/zkas /opt/darkfi/vanityaddr \
/opt/darkfi/tau /opt/darkfi/taud ./

View File

@@ -1,41 +1,54 @@
# Use: docker build . --pull --network=host -t darkfi:debian -f ./contrib/docker/Dockerfile.debian
# optionally with: --build-arg BUILD_OS_VER=slim-buster --build-arg RUN_OS_VER=buster-slim --build-arg RUST_VER=1.70
# rust nightly with: BUILD_OS_VER=bullseye-slim RUN_OS_VER=bullseye-slim RUST_VER=nightly REPOSITORY=rustlang/rust
# Use: docker build . --pull --no-cache --shm-size=196m -t darkfi:debian -f ./contrib/docker/Dockerfile.debian --build-arg DONT_EXEC_TESTS=1
# optionally with: --build-arg OS_VER=bullseye-slim --build-arg RUST_VER=nightly
ARG RUST_VER=1.70 # 1.67
ARG BUILD_OS_VER=slim-bookworm # (12); slim-bullseye (11); slim-buster (10)
ARG RUN_OS_VER=bookworm-slim # (12); bullseye-slim (11); buster-slim (10)
ARG REPOSITORY=rust # rustlang/rust
ARG RUST_VER=nightly-2023-06-21 # nightly 1.72
ARG OS_VER=bookworm-slim # (12); bullseye-slim (11); buster-slim (10)
FROM ${REPOSITORY}:${RUST_VER}-${BUILD_OS_VER} as builder
FROM debian:${OS_VER} as rust_builder
ARG RUST_VER
RUN apt-get update && apt-get install -y build-essential cmake jq wget \
pkg-config clang libclang-dev llvm-dev libudev-dev libfreetype6-dev \
libexpat1-dev curl gcc make libssl-dev fonts-lato libfontconfig-dev \
libasound2-dev
pkg-config clang libclang-dev llvm-dev libudev-dev libfreetype6-dev libasound2-dev \
libexpat1-dev curl gcc make libssl-dev fonts-lato libfontconfig-dev python3-dev libsqlite3-dev
RUN mkdir /opt/darkfi
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y --default-toolchain "${RUST_VER}"
COPY . /opt/darkfi
WORKDIR /opt/darkfi
ENV PATH="/root/.cargo/bin:${PATH}"
RUN rustup target add wasm32-unknown-unknown
RUN make clean
RUN rm -rf ./target/*
RUN bash -c 'make -j test && make -j all'
RUN cargo search whatever # creates .cargo cache
# 2. stage
FROM debian:${RUN_OS_VER}
FROM rust_builder as builder
RUN apt-get -y update && apt-get install -y openssl fonts-lato \
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 debian:${OS_VER}
RUN apt-get -y update && apt-get install -y openssl fonts-lato libout123-0 libmpg123-0 libasound2 libsqlite3-0 \
&& 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 ./
/opt/darkfi/darkirc /opt/darkfi/faucetd \
/opt/darkfi/zkas /opt/darkfi/vanityaddr \
/opt/darkfi/tau /opt/darkfi/taud ./

View File

@@ -1,8 +1,9 @@
# Use: docker build . --pull --network=host -t darkfi:fedora -f ./contrib/docker/Dockerfile.fedora
# optionally with: --build-arg OS_VER=fedora:36 --build-arg RUST_VER=nightly
# Use: docker build . --pull --no-cache --shm-size=196m -t darkfi:fedora -f ./contrib/docker/Dockerfile.fedora --build-arg DONT_EXEC_TESTS=1
# optionally with: --build-arg OS_VER=fedora:37 --build-arg RUST_VER=nightly
# To use the legacy deprecated builder: DOCKER_BUILDKIT=0
ARG RUST_VER=1.70 # stable nightly beta 1.67
ARG OS_VER=fedora:37 # fedora:36
ARG RUST_VER=nightly-2023-06-21 # stable nightly beta 1.72
ARG OS_VER=fedora:38 # fedora:37
FROM ${OS_VER} as rust_builder
@@ -11,7 +12,9 @@ ARG RUST_VER
RUN dnf -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
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}"
@@ -19,30 +22,38 @@ ENV PATH="/root/.cargo/bin:${PATH}"
RUN rustup target add wasm32-unknown-unknown
RUN cargo search whatever # creates .cargo cache
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 cargo update
RUN make clean
RUN rm -rf ./target/
RUN rm -rf ./target/ zkas proof/*.bin
RUN bash -c 'make -j test && make -j all'
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 dnf -y install openssl lato-fonts \
RUN dnf -y install openssl lato-fonts alsa-lib \
&& dnf clean all \
&& rm -rf /var/cache/dnf
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 ./
/opt/darkfi/darkirc /opt/darkfi/faucetd \
/opt/darkfi/zkas /opt/darkfi/vanityaddr \
/opt/darkfi/tau /opt/darkfi/taud ./

View File

@@ -1,12 +1,10 @@
# Use: docker build . --network=host --pull -t darkfi:ubuntu -f ./contrib/docker/Dockerfile.ubuntu
# optionally with: --build-arg BUILD_OS_VER=20.04 --build-arg RUST_VER=1.70
# Use: docker build . --pull --no-cache --shm-size=196m -t darkfi:ubuntu -f ./contrib/docker/Dockerfile.ubuntu --build-arg DONT_EXEC_TESTS=1
# optionally with: --build-arg OS_VER=20.04 --build-arg RUST_VER=nightly
ARG RUST_VER=1.70 # stable nightly beta 1.67
ARG BUILD_OS_VER=22.04 # 20.04
ARG RUN_OS_VER=${BUILD_OS_VER}
ARG REPOSITORY=ubuntu
ARG RUST_VER=nightly-2023-06-21 # stable nightly beta 1.72
ARG OS_VER=22.04 # 20.04
FROM ${REPOSITORY}:${BUILD_OS_VER} as rust_builder
FROM ubuntu:${OS_VER} as rust_builder
ARG RUST_VER
@@ -14,7 +12,7 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install
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 \
libasound2-dev
libasound2-dev python3-dev libsqlite3-dev
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y --default-toolchain "${RUST_VER}"
@@ -27,24 +25,32 @@ 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 cargo update
RUN make clean
RUN rm -rf ./target/*
RUN rm -rf ./target/ zkas proof/*.bin
RUN bash -c 'make -j test && make -j all'
RUN bash -c "if [ -z \"$DONT_EXEC_TESTS\" ]; then make -j test; fi"
RUN bash -c 'make -j all'
# 3. stage
FROM ${REPOSITORY}:${RUN_OS_VER}
FROM ubuntu:${OS_VER}
RUN apt-get -y update && apt-get install -y openssl fonts-lato \
RUN apt-get -y update && apt-get install -y openssl fonts-lato libout123-0 libmpg123-0 libasound2 libsqlite3-0 \
&& 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 ./
/opt/darkfi/darkirc /opt/darkfi/faucetd \
/opt/darkfi/zkas /opt/darkfi/vanityaddr \
/opt/darkfi/tau /opt/darkfi/taud ./

View File

@@ -1,13 +1,11 @@
# 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
# Use: docker build . --platform=linux/arm64 --pull -t darkfi:ubuntu_arm64 -f contrib/docker/Dockerfile.ubuntuARMviaEmulation --build-arg DONT_EXEC_TESTS=1
# optionally with: --build-arg BUILD_OS_VER=20.04 --build-arg RUST_VER=1.70
ARG RUST_VER=1.70 # stable nightly beta 1.67
ARG BUILD_OS_VER=22.04 # 20.04
ARG RUN_OS_VER=${BUILD_OS_VER}
ARG REPOSITORY=ubuntu
ARG RUST_VER=nightly-2023-06-21 # stable nightly beta 1.72
ARG OS_VER=22.04 # 20.04
FROM --platform=$TARGETPLATFORM ${REPOSITORY}:${BUILD_OS_VER} as rust_builder
FROM --platform=$TARGETPLATFORM ubuntu:${OS_VER} as rust_builder
ARG TARGETPLATFORM
ARG BUILDPLATFORM
ARG RUST_VER
@@ -17,7 +15,7 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install
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 \
libasound2-dev
libasound2-dev python3-dev libsqlite3-dev
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y --default-toolchain "${RUST_VER}"
@@ -31,24 +29,33 @@ RUN cargo install -f cross
# 2. stage
FROM --platform=$TARGETPLATFORM rust_builder as builder
ARG DONT_EXEC_TESTS
ARG RUST_VER
WORKDIR /opt/darkfi
COPY . /opt/darkfi
RUN cargo update
RUN make clean
RUN rm -rf ./target/*
RUN rm -rf ./target/ zkas proof/*.bin
RUN bash -c 'make -j test && make -j all'
RUN bash -c "if [ -z \"$DONT_EXEC_TESTS\" ]; then make -j test; fi"
RUN bash -c 'make -j all'
# 3. stage
FROM --platform=$TARGETPLATFORM ${REPOSITORY}:${RUN_OS_VER}
FROM --platform=$TARGETPLATFORM ubuntu:${OS_VER}
RUN apt-get -y update && apt-get install -y openssl fonts-lato \
RUN apt-get -y update && apt-get install -y openssl fonts-lato libout123-0 libmpg123-0 libasound2 libsqlite3-0 \
&& 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 ./
/opt/darkfi/darkirc /opt/darkfi/faucetd \
/opt/darkfi/zkas /opt/darkfi/vanityaddr \
/opt/darkfi/tau /opt/darkfi/taud ./

View File

@@ -1,7 +1,7 @@
.POSIX:
# Cargo binary
CARGO = cargo
CARGO = cargo +nightly
# zkas compiler binary
ZKAS = ../../../zkas