From 39eae2795faa87d78a5390005da5defab115c26b Mon Sep 17 00:00:00 2001 From: Luke Parker Date: Wed, 26 Jul 2023 03:06:01 -0400 Subject: [PATCH] Update Dockerfiles to bookworm, successfully Removes use of the Parity CI image. Always uses slim variants. --- deploy/coins/bitcoin/Dockerfile | 5 ++++- deploy/coins/monero/Dockerfile | 5 ++++- deploy/message-queue/Dockerfile | 7 +++++-- deploy/processor/Dockerfile | 13 +++++++++---- deploy/serai/Dockerfile | 33 +++++++++++---------------------- 5 files changed, 33 insertions(+), 30 deletions(-) diff --git a/deploy/coins/bitcoin/Dockerfile b/deploy/coins/bitcoin/Dockerfile index 755b0c3e..a3b215ff 100644 --- a/deploy/coins/bitcoin/Dockerfile +++ b/deploy/coins/bitcoin/Dockerfile @@ -26,12 +26,15 @@ RUN grep bitcoin-${BITCOIN_VERSION}-x86_64-linux-gnu.tar.gz SHA256SUMS | sha256s # Prepare Image RUN tar xzvf bitcoin-${BITCOIN_VERSION}-x86_64-linux-gnu.tar.gz -FROM debian:bullseye-slim as image +FROM debian:bookworm-slim as image WORKDIR /home/bitcoin COPY --from=builder /home/bitcoin/* . RUN mv bin/* /bin && mv lib/* /lib COPY ./scripts /scripts +# Upgrade packages +RUN apt update && apt upgrade -y + EXPOSE 8332 8333 18332 18333 18443 18444 VOLUME ["/home/bitcoin/.bitcoin"] diff --git a/deploy/coins/monero/Dockerfile b/deploy/coins/monero/Dockerfile index 6e6dfe62..842f9146 100644 --- a/deploy/coins/monero/Dockerfile +++ b/deploy/coins/monero/Dockerfile @@ -27,12 +27,15 @@ RUN gpg --keyserver hkp://keyserver.ubuntu.com:80 --keyserver-options no-self-si RUN tar -xvjf monero-linux-x64-v${MONERO_VERSION}.tar.bz2 --strip-components=1 # Prepare Image -FROM debian:bullseye-slim as image +FROM debian:bookworm-slim as image WORKDIR /home/monero COPY --from=builder /home/monero/* . RUN mv * /bin/ COPY ./scripts /scripts +# Upgrade packages +RUN apt update && apt upgrade -y + EXPOSE 18080 18081 VOLUME /home/monero/.bitmonero diff --git a/deploy/message-queue/Dockerfile b/deploy/message-queue/Dockerfile index 3f9ba815..4471b083 100644 --- a/deploy/message-queue/Dockerfile +++ b/deploy/message-queue/Dockerfile @@ -1,4 +1,4 @@ -FROM rust:1.71 as builder +FROM rust:1.71-slim-bookworm as builder LABEL description="STAGE 1: Build" # Add files for build @@ -29,7 +29,7 @@ RUN --mount=type=cache,target=/root/.cargo \ mv /serai/target/release/serai-message-queue /serai/bin # Prepare Image -FROM debian:bullseye-slim as image +FROM debian:bookworm-slim as image LABEL description="STAGE 2: Copy and Run" WORKDIR /home/serai @@ -38,6 +38,9 @@ WORKDIR /home/serai COPY --from=builder /serai/bin/* /bin/ COPY --from=builder /serai/AGPL-3.0 . +# Upgrade packages +RUN apt update && apt upgrade -y + # Run message-queue EXPOSE 2287 CMD ["serai-message-queue"] diff --git a/deploy/processor/Dockerfile b/deploy/processor/Dockerfile index 33cfef8e..6537a887 100644 --- a/deploy/processor/Dockerfile +++ b/deploy/processor/Dockerfile @@ -1,4 +1,4 @@ -FROM docker.io/paritytech/ci-linux:production as builder +FROM rust:1.71-slim-bookworm as builder LABEL description="STAGE 1: Build" # Add files for build @@ -16,6 +16,11 @@ ADD AGPL-3.0 /serai WORKDIR /serai +RUN apt update && apt upgrade -y && apt install -y clang libssl-dev + +# Add the wasm toolchain +RUN rustup target add wasm32-unknown-unknown + # Mount the caches and build RUN --mount=type=cache,target=/root/.cargo \ --mount=type=cache,target=/usr/local/cargo/registry \ @@ -27,7 +32,7 @@ RUN --mount=type=cache,target=/root/.cargo \ mv /serai/target/release/serai-processor /serai/bin # Prepare Image -FROM debian:bullseye-slim as image +FROM debian:bookworm-slim as image LABEL description="STAGE 2: Copy and Run" WORKDIR /home/serai @@ -36,8 +41,8 @@ WORKDIR /home/serai COPY --from=builder /serai/bin/* /bin/ COPY --from=builder /serai/AGPL-3.0 . -# Install openssl -RUN apt update && apt upgrade -y && apt install -y libssl +# Upgrade packages and install openssl +RUN apt update && apt upgrade -y && apt install -y libssl-dev # Run processor CMD ["serai-processor"] diff --git a/deploy/serai/Dockerfile b/deploy/serai/Dockerfile index 467f7b9a..2bc63f40 100644 --- a/deploy/serai/Dockerfile +++ b/deploy/serai/Dockerfile @@ -1,4 +1,4 @@ -FROM docker.io/paritytech/ci-linux:production as builder +FROM rust:1.71-slim-bookworm as builder LABEL description="STAGE 1: Build" # Add files for build @@ -16,34 +16,20 @@ ADD AGPL-3.0 /serai WORKDIR /serai -# Update Rust -RUN rustup update +RUN apt update && apt upgrade -y && apt install -y make clang libssl-dev protobuf-compiler -# Install Solc @ 0.8.16 -RUN --mount=type=cache,target=/root/.cache \ - --mount=type=cache,target=/root/.local \ - --mount=type=cache,target=/root/.solc-select \ - pip3 install solc-select==0.2.1 -RUN --mount=type=cache,target=/root/.cache \ - --mount=type=cache,target=/root/.local \ - --mount=type=cache,target=/root/.solc-select \ - solc-select install 0.8.16 -RUN --mount=type=cache,target=/root/.cache \ - --mount=type=cache,target=/root/.local \ - --mount=type=cache,target=/root/.solc-select \ - solc-select use 0.8.16 +# Add the wasm toolchain +RUN rustup target add wasm32-unknown-unknown -# Mount cargo and the Serai cache -RUN --mount=type=cache,target=/root/.local \ - --mount=type=cache,target=/root/.solc-select \ - --mount=type=cache,target=/root/.cache \ - --mount=type=cache,target=/usr/local/cargo/git \ +# Mount the caches and build +RUN --mount=type=cache,target=/root/.cargo \ --mount=type=cache,target=/usr/local/cargo/registry \ + --mount=type=cache,target=/usr/local/cargo/git \ --mount=type=cache,target=/serai/target \ cd substrate/node && cargo build --release # Prepare Image -FROM ubuntu:latest as image +FROM debian:bookworm-slim as image LABEL description="STAGE 2: Copy and Run" WORKDIR /home/serai @@ -52,6 +38,9 @@ WORKDIR /home/serai COPY --from=builder /serai/target/release/ /bin/ COPY --from=builder /serai/AGPL-3.0 . +# Upgrade packages +RUN apt update && apt upgrade -y + # Run node EXPOSE 30333 9615 9933 9944 CMD ["serai-node"]