Skip to content
This repository has been archived by the owner on Feb 17, 2024. It is now read-only.

Commit

Permalink
Dockerfile: build docker image "from scratch" instad of "from rust"
Browse files Browse the repository at this point in the history
RUSTC_BOOTSTRAP=1 doesn't work so well anymore in stable, so we had to
migrate to nightly - which required us to install the toolchain in an
image that already has one. If we install rust manually in a
debian-slim, we save ~500MB.

We are also pinning nightly to a version where coverage works.
Ref: rust-lang/rust#93054
  • Loading branch information
lpenz committed Jan 24, 2022
1 parent d821b51 commit 43e76b4
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,33 @@
# This file is subject to the terms and conditions defined in
# file 'LICENSE', which is part of this source code package.

FROM rust:slim
RUN set -e -x; \
# Adapted from https://github.com/rust-lang/docker-rust/blob/master/Dockerfile-slim.template

FROM debian:bullseye-slim

ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH

RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends \
ca-certificates \
gcc \
libc6-dev \
wget \
; \
wget https://sh.rustup.rs -O rustup-init; \
bash rustup-init -y --no-modify-path --profile minimal --default-toolchain nightly-2022-01-14; \
rm rustup-init; \
chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \
rustup --version; \
cargo --version; \
rustc --version; \
apt-get remove -y --auto-remove \
wget \
; \
rm -rf /var/lib/apt/lists/*; \
rustup component add llvm-tools-preview; \
cargo install cargo-llvm-cov

Expand Down

0 comments on commit 43e76b4

Please sign in to comment.