• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2021 The Chromium OS Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4#
5# Base image for crosvm_builder and crosvm_aarch64_builder containing basic
6# devleopment environment for building rust.
7
8# TODO(b/177078591): Use debian buster and backports (or manual dpkg downloads)
9# of outdated libraries. Sid could blow up on us any day.
10FROM debian:buster
11
12# Set timezone so apt-get won't try to prompt
13ARG DEBIAN_FRONTEND=noninteractive
14ENV TZ=US/Pacific
15
16# Add bullseye to sources so we can install some newer versions of packages.
17RUN echo 'deb http://deb.debian.org/debian bullseye main' >/etc/apt/sources.list.d/testing.list
18RUN echo 'APT::Default-Release "stable";' >/etc/apt/apt.conf.d/99_default_stable
19
20RUN apt-get update && apt-get install --yes --no-install-recommends \
21    ca-certificates \
22    curl \
23    g++ \
24    gcc \
25    git \
26    jq \
27    make \
28    meson/testing \
29    nasm \
30    ninja-build \
31    openssh-client \
32    pkg-config \
33    protobuf-compiler \
34    python3 \
35    python3-setuptools \
36    rsync \
37    screen \
38    sudo
39
40# This is a scratch volume for build files. It can be used to allow incremental
41# builds between container runs.
42# Note: This volume is optional if incremental builds are not required.
43VOLUME /workspace/scratch
44
45# This is where the chromiumos source tree will be mounted
46VOLUME /workspace/src
47
48# This is a volume to store additional logs for kokoro builds that are uploaded
49# to sponge.
50VOLUME /workspace/logs
51
52# Install the current crosvm rust toolchain via rustup.
53COPY rust-toolchain ./
54RUN curl https://sh.rustup.rs -sSf | sh -s -- \
55    -y \
56    --profile minimal \
57    -c rustfmt,clippy \
58    --default-toolchain $(cat rust-toolchain)
59ENV PATH="/root/.cargo/bin:${PATH}"
60
61# Point cargo to store data on the scratch volume.
62ENV CARGO_TARGET_DIR=/workspace/scratch/cargo_target
63ENV CARGO_HOME=/workspace/scratch/cargo_home
64
65# Warms up the cargo registry cache for future cargo runs. Cargo will still
66# update the cache using a git pull, but it only needs to download files that
67# were changed since this image was built.
68RUN cargo install thisiznotarealpackage -q || true
69
70# We are building out of source with a readonly source filesystem. This flag
71# tells some build.rs files to not write into the src filesystem.
72ENV RUSTFLAGS='--cfg hermetic'
73
74# Environment variables for the run_tests script to enable all tests.
75ENV CROSVM_CROS_BUILD=1
76
77# All commands will be executed in the crosvm src directory.
78WORKDIR /workspace/src/platform/crosvm
79