Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reduce image size by using to distroless #30

Open
vigith opened this issue Feb 18, 2024 · 0 comments
Open

reduce image size by using to distroless #30

vigith opened this issue Feb 18, 2024 · 0 comments

Comments

@vigith
Copy link
Member

vigith commented Feb 18, 2024

Example,

FROM rust:1.76-bookworm as build

RUN apt-get update
RUN apt-get install protobuf-compiler -y

# create a new empty shell project
WORKDIR /examples

# copy your source tree
COPY src ./src

COPY ./Cargo.toml ./Cargo.toml
COPY ./Cargo.lock ./Cargo.lock

# build for release
RUN cargo build --release

# our final base
FROM gcr.io/distroless/cc-debian12

# copy the build artifact from the build stage
COPY --from=build /examples/target/release/server /

# set the startup command to run your binary
CMD ["/server"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant