Move apt calls in Docker to enable caching

This commit is contained in:
Luke Parker 2023-08-12 22:51:12 -04:00
parent 6a89cfcd08
commit 049fefb5fd
No known key found for this signature in database
6 changed files with 29 additions and 25 deletions

View file

@ -30,7 +30,7 @@ RUN mv bitcoin-${BITCOIN_VERSION}/bin/bitcoind .
FROM debian:bookworm-slim as image
# Upgrade packages
RUN apt update && apt upgrade -y
RUN apt update && apt upgrade -y && && apt autoremove -y && apt clean
# Switch to a non-root user
RUN useradd --system --create-home --shell /sbin/nologin bitcoin

View file

@ -1,6 +1,12 @@
FROM rust:1.71-slim-bookworm as builder
LABEL description="STAGE 1: Build"
# Upgrade and add dev dependencies
RUN apt update && apt upgrade -y && apt install -y pkg-config clang libssl-dev && apt autoremove -y && apt clean
# Add the wasm toolchain
RUN rustup target add wasm32-unknown-unknown
# Add files for build
ADD common /serai/common
ADD crypto /serai/crypto
@ -16,11 +22,6 @@ ADD AGPL-3.0 /serai
WORKDIR /serai
RUN apt update && apt upgrade -y && apt install -y pkg-config 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 \
@ -36,7 +37,7 @@ FROM debian:bookworm-slim as image
LABEL description="STAGE 2: Copy and Run"
# Upgrade packages and install openssl
RUN apt update && apt upgrade -y && apt install -y libssl-dev
RUN apt update && apt upgrade -y && apt install -y libssl-dev && apt autoremove && apt clean
# Switch to a non-root user
RUN useradd --system --create-home --shell /sbin/nologin coordinator

View file

@ -1,6 +1,9 @@
FROM rust:1.71-slim-bookworm as builder
LABEL description="STAGE 1: Build"
# Upgrade and add dev dependencies
RUN apt update && apt upgrade -y && apt install -y pkg-config clang libssl-dev && apt autoremove -y && apt clean
# Add files for build
ADD common /serai/common
ADD crypto /serai/crypto
@ -16,8 +19,6 @@ ADD AGPL-3.0 /serai
WORKDIR /serai
RUN apt update && apt install -y pkg-config clang libssl-dev
# Mount the caches and build
RUN --mount=type=cache,target=/root/.cargo \
--mount=type=cache,target=/usr/local/cargo/registry \

View file

@ -1,6 +1,9 @@
FROM rust:1.71-slim-bookworm as builder
LABEL description="STAGE 1: Build"
# Upgrade and add dev dependencies
RUN apt update && apt upgrade -y && apt install -y pkg-config clang libssl-dev && apt autoremove -y && apt clean
# Add files for build
ADD common /serai/common
ADD crypto /serai/crypto
@ -16,8 +19,6 @@ ADD AGPL-3.0 /serai
WORKDIR /serai
RUN apt update && apt upgrade -y && apt install -y pkg-config clang libssl-dev
# Add the wasm toolchain
RUN rustup target add wasm32-unknown-unknown

View file

@ -1,5 +1,17 @@
FROM rust:1.71.1-slim-bookworm as builder
# Move to a Debian package snapshot
RUN rm -rf /etc/apt/sources.list.d/debian.sources && \
rm -rf /var/lib/apt/lists/* && \
echo "deb [arch=amd64] http://snapshot.debian.org/archive/debian/20230703T000000Z bookworm main" > /etc/apt/sources.list && \
apt update
# Install dependencies
RUN apt install clang -y
# Add the wasm toolchain
RUN rustup target add wasm32-unknown-unknown
# Add files for build
ADD common /serai/common
ADD crypto /serai/crypto
@ -14,15 +26,3 @@ ADD Cargo.lock /serai
ADD AGPL-3.0 /serai
WORKDIR /serai
# Move to a Debian package snapshot
RUN rm -rf /etc/apt/sources.list.d/debian.sources && \
rm -rf /var/lib/apt/lists/* && \
echo "deb [arch=amd64] http://snapshot.debian.org/archive/debian/20230703T000000Z bookworm main" > /etc/apt/sources.list && \
apt update
# Install dependencies
RUN apt install clang -y
# Add the wasm toolchain
RUN rustup target add wasm32-unknown-unknown

View file

@ -1,6 +1,9 @@
FROM rust:1.71-slim-bookworm as builder
LABEL description="STAGE 1: Build"
# Upgrade and add dev dependencies
RUN apt update && apt upgrade -y && apt install -y git pkg-config make clang libssl-dev protobuf-compiler && apt autoremove -y && apt clean
# Add files for build
ADD common /serai/common
ADD crypto /serai/crypto
@ -16,8 +19,6 @@ ADD AGPL-3.0 /serai
WORKDIR /serai
RUN apt update && apt upgrade -y && apt install -y git pkg-config make clang libssl-dev protobuf-compiler
# Add the wasm toolchain
RUN rustup target add wasm32-unknown-unknown