Pin the toolchain to Rust 1.98 via rust-toolchain.toml and bump the builder image to rust:1.98-trixie. Move the runtime image from Debian bookworm to trixie, replacing libssl3 with libssl3t64 which is the OpenSSL runtime package name in trixie.
44 lines
1.3 KiB
Docker
44 lines
1.3 KiB
Docker
# Build stage
|
|
FROM rust:1.98-trixie AS builder
|
|
|
|
WORKDIR /usr/src/pop_imap_importer
|
|
|
|
# Copy manifests first to leverage Docker layer caching
|
|
COPY Cargo.* ./
|
|
|
|
# Create dummy source files to build dependencies
|
|
RUN mkdir -p src/bin && \
|
|
echo "fn main() {}" > src/main.rs && \
|
|
echo "" > src/lib.rs && \
|
|
echo "fn main() {}" > src/bin/normalize_imap.rs && \
|
|
echo "fn main() {}" > src/bin/fetch_email.rs && \
|
|
echo "fn main() {}" > src/bin/list_uids.rs
|
|
|
|
# Build dependencies only - this will be cached as long as Cargo.toml/Cargo.lock don't change
|
|
RUN --mount=type=cache,target=/usr/local/cargo/registry \
|
|
cargo build --release
|
|
|
|
# Copy the actual source code
|
|
COPY src src
|
|
# Touch source files to force rebuild
|
|
RUN touch src/main.rs src/lib.rs
|
|
|
|
# Build the actual application
|
|
RUN --mount=type=cache,target=/usr/local/cargo/registry \
|
|
ls -lh target/release && \
|
|
cargo build --release
|
|
|
|
# Runtime stage
|
|
FROM debian:trixie-slim
|
|
|
|
# Install CA certificates and OpenSSL runtime libraries
|
|
RUN apt-get update && \
|
|
apt-get install -y ca-certificates libssl3t64 && \
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
# RUN apt-get update && apt-get install -y extra-runtime-dependencies && rm -rf /var/lib/apt/lists/*
|
|
COPY --from=builder /usr/src/pop_imap_importer/target/release/pop-to-imap /usr/local/bin/pop_imap_importer
|
|
|
|
CMD ["pop_imap_importer"]
|
|
|