Sign inSign up

jdrouet/rust-nightly

By jdrouet

Updated over 5 years ago

Image
1

10K+

jdrouet/rust-nightly repository overview

Docker image for Rust Nightly

Find it on the Docker Hub.

For typical use cases, see the official image.

Usage

If you need the nightly version to build your project, keep in mind to do a multistage build to reduce your final image size.

FROM jdrouet/rust-nightly:buster-slim AS builder

WORKDIR /code
COPY /path/to/my/project /code
RUN cargo build --release

FROM debian:buster-slim

COPY --from=builder /code/target/release/project-name /project-name

CMD ["/project-name"]

That way, you'll reduce your final image size to have the debian buster-slim image size plus the size of your binary.

To multi-arch build this image, you can create a manifest or just use docker buildx with the following command.

docker buildx build \
  --platform linux/arm/v7,linux/arm64/v8,linux/386,linux/amd64,linux/ppc64le \
  -t my-image-name:tag-name \
  /path/to/my/dockerfile

Multi-arch limit

Depending on the base image you are using, you won't be able to build for every platform.

ArchAlpine3.10Debian
linux/arm/v6
linux/arm/v7
linux/arm64/v8
linux/386
linux/amd64
linux/ppc64le

This is mainly due to the availability of the rust toolchain for the architecture and the version of libc it is using. For example, we can only build for amd64 when using alpine due to the fact that the toolchain for the musl version of libc is only available for x86_64

Tag summary

Content type

Image

Digest

Size

246.9 MB

Last updated

over 5 years ago

docker pull jdrouet/rust-nightly:stretch-slim-20201230