A Docker image that allows building of Rust applications for Linux machines.
852
A Docker image that allows building of Rust applications for Linux machines.
The image comes out of the box with support for x86_64-unknown-linux-musl and x86_64-unknown-linux-gnu
target triple. The default target is x86_64-unknown-linux-gnu.
This is published on Dockerhub.
1.18.0, v1.18.0, latest (Dockerfile)Multi-stage builds are recommended so that the final image will be as small and compact as possible. This is demonstrated in the examples below.
x86_64-unknown-linux-gnuFROM lawliet89/docker-rust:1.19.0 as builder
WORKDIR /app/src
COPY Cargo.toml Cargo.lock ./
RUN cargo fetch --locked -v
COPY ./ ./
RUN cargo build --release -v --frozen
# Runtime Image
FROM alpine:3.5
WORKDIR /app
COPY --from=builder /app/src/target/release/your_application_name_here .
CMD [/app/your_application_name_here]
x86_64-unknown-linux-muslFROM lawliet89/docker-rust:1.19.0 as builder
ARG ARCHITECTURE=x86_64-unknown-linux-musl
WORKDIR /app/src
COPY Cargo.toml Cargo.lock ./
RUN cargo fetch --locked -v
COPY ./ ./
RUN cargo build --release --target "${ARCHITECTURE}" -v --frozen
# Runtime Image
FROM alpine:3.5
ARG ARCHITECTURE=x86_64-unknown-linux-musl
WORKDIR /app
COPY --from=builder /app/src/target/${ARCHITECTURE}/release/your_application_name_here .
CMD [/app/your_application_name_here]
Content type
Image
Digest
Size
338.7 MB
Last updated
about 9 years ago
docker pull lawliet89/docker-rust