Sean Humeniuk

Software Developer

Dockerfile for Rust Nightly

The following dockerfile can be used to create a Rust nightly image.

FROM rust:latest

RUN rustup default nightly

WORKDIR /usr/src/

RUN USER=root cargo new my-project

COPY Cargo.toml Cargo.lock /usr/src/my-project/

WORKDIR /usr/src/my-project

RUN cargo build

COPY src/. /usr/src/my-project/src/

RUN cargo clean -p my-project

RUN cargo build

EXPOSE 8000

CMD ["cargo", "run"]