Hi everyone
This is the Dockerfile I created to containerise my Rust CLI project. I’d really appreciate any feedback or suggestions on how I could improve it.
It’s the first Dockerfile I’ve written completely on my own without asking an AI to generate it for me, so I know there’s still a lot I can learn.
FROM rust:1.95-slim-bullseye as builder
WORKDIR /luffy/src/myapp
COPY Cargo.toml Cargo.lock ./
COPY src ./src
RUN cargo build --release
FROM debian:bullseye-slim
RUN apt-get update && \
apt-get install -y ca-certificates && \
rm -rf /var/lib/apt/lists/*
COPY --from=builder /luffy/src/myapp/target/release/github-user-activity /usr/src/local/bin/github-user-activity
ENTRYPOINT ["./usr/src/local/bin/github-user-activity"]
Thanks in advance for any advice or recommendations.
It is a short Dockerfile that looks good to me. Is there any specific in the Dockerfile you would like to ask about which you were not sure about?
NOTE: I moved the topic out of the Support category which is for topics that could require Docker Support or for forum feedbacks, not Docker-related questions.
Thanks for moving the topic to the correct category.
At the moment, I mainly wanted general feedback because this is the first Dockerfile I’ve written completely on my own. I’m especially interested in learning about best practices, image optimisation, security improvements, and whether there are more idiomatic ways to structure Rust Docker images.
So even small suggestions or things you would personally do differently would help me learn a lot.