fix: add certificates to Docker containers

This commit is contained in:
dboures 2023-05-08 20:24:31 -05:00
parent 67c79a1b8f
commit d855f540ea
No known key found for this signature in database
GPG Key ID: AB3790129D478852
2 changed files with 10 additions and 4 deletions

View File

@ -7,13 +7,16 @@ RUN cargo chef prepare --recipe-path server-recipe.json
FROM chef AS builder
COPY --from=planner server-recipe.json server-recipe.json
RUN apt-get update && apt-get install -y libudev-dev clang pkg-config libssl-dev build-essential cmake
RUN rustup component add rustfmt
RUN rustup component add rustfmt && update-ca-certificates
RUN cargo chef cook --release --recipe-path server-recipe.json
# Build application
COPY . .
RUN cargo build --release --bin server
FROM debian:bullseye-slim as base_image
RUN apt-get update && apt-get -y install ca-certificates libssl1.1
# We do not need the Rust toolchain to run the binary!
FROM debian:bullseye-slim AS runtime
FROM base_image AS runtime
COPY --from=builder /target/release/server /usr/local/bin
ENTRYPOINT ["/usr/local/bin/server"]

View File

@ -7,13 +7,16 @@ RUN cargo chef prepare --recipe-path worker-recipe.json
FROM chef AS builder
COPY --from=planner worker-recipe.json worker-recipe.json
RUN apt-get update && apt-get install -y libudev-dev clang pkg-config libssl-dev build-essential cmake
RUN rustup component add rustfmt
RUN rustup component add rustfmt && update-ca-certificates
RUN cargo chef cook --release --recipe-path worker-recipe.json
# Build application
COPY . .
RUN cargo build --release --bin worker
FROM debian:bullseye-slim as base_image
RUN apt-get update && apt-get -y install ca-certificates libssl1.1
# We do not need the Rust toolchain to run the binary!
FROM debian:bullseye-slim AS runtime
FROM base_image AS runtime
COPY --from=builder /target/release/worker /usr/local/bin
ENTRYPOINT ["/usr/local/bin/worker"]