Skip to content

Commit

Permalink
new: optimized docker image size
Browse files Browse the repository at this point in the history
  • Loading branch information
evilsocket committed Nov 16, 2023
1 parent 459a32e commit 6298f95
Showing 1 changed file with 5 additions and 16 deletions.
21 changes: 5 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,11 @@
# build stage
FROM rust:bookworm as build
FROM rust:bullseye as builder

RUN apt-get update && apt-get install -y libssl-dev ca-certificates cmake git

# create a new empty shell project
RUN USER=root cargo new --bin legba
WORKDIR /legba

# copy contents
COPY ./Cargo.lock ./Cargo.lock
COPY ./Cargo.toml ./Cargo.toml
COPY ./src ./src

# build
WORKDIR /app
ADD . /app
RUN cargo build --release

FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y libssl-dev ca-certificates && rm -rf /var/lib/apt/lists/*
RUN update-ca-certificates
COPY --from=build /legba/target/release/legba /usr/bin/legba
FROM gcr.io/distroless/cc-debian11
COPY --from=builder /app/target/release/legba /usr/bin/legba
ENTRYPOINT ["/usr/bin/legba"]

0 comments on commit 6298f95

Please sign in to comment.