Skip to content

reduce image size by using to distroless #30

Open
@vigith

Description

@vigith

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"]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions