crosvm/ci/crosvm_base/Dockerfile
Dennis Kempin 191b95b5d7 native and aarch64 cross-compile containers
This CL adds the foundation for running tests consistently
in Kokoro and locally, for both x86 and aarch64.

The crosvm_builder is similar to the original image from
docker/crosvm.Dockerfile.
The main difference is that ChromeOS dependencies are not
compiled into the container, but built at runtime.

The crosvm_aarch64_builder installs the build enviornment
to cross-compile crosvm for aarch64. The tests are run
with user-space emulation using qemu-aarch64-static.

See ci/README.md for instructions on how to use these
builders.

Tests on aarch64 cannot all be run using user-space
emulation. We will need a VM to pass all smoke tests,
this work is tracked in b/177228167.

BUG=b:177133814
TEST=Tested by running
./ci/builder bin/smoke_test
./ci/builder cargo test
./ci/aarch64_builder cargo build
./ci/aarch64_builder cargo test -p tempfile

Change-Id: Iffffcf48894787dd72fff894af351fdaced0b429
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2621994
Reviewed-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Tested-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2021-01-20 17:41:27 +00:00

67 lines
2.2 KiB
Docker

# Copyright 2018 The Chromium OS Authors. All rights reserved. Use of this
# source code is governed by a BSD-style license that can be found in the
# LICENSE file.
#
# Base image for crosvm_builder and crosvm_aarch64_builder containing basic
# devleopment environment for building rust.
# TODO(b/177078591): Use debian buster and backports (or manual dpkg downloads)
# of outdated libraries. Sid could blow up on us any day.
FROM debian:buster
# Set timezone so apt-get won't try to prompt
ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=US/Pacific
# Add bullseye to sources so we can install some newer versions of packages.
RUN echo 'deb http://deb.debian.org/debian bullseye main' > /etc/apt/sources.list.d/testing.list
RUN echo 'APT::Default-Release "stable";' > /etc/apt/apt.conf.d/99_default_stable
RUN apt-get update && apt-get install --yes --no-install-recommends \
ca-certificates \
curl \
g++ \
gcc \
git \
jq \
make \
meson/testing \
nasm \
ninja-build \
pkg-config \
protobuf-compiler \
python3 \
python3-setuptools \
sudo
# This is a scratch volume for build files. It can be used to allow incremental
# builds between container runs.
VOLUME /workspace/scratch
# This is where the chromiumos source tree will be mounted
VOLUME /workspace/src
# Install the current crosvm rust toolchain via rustup.
COPY rust-toolchain ./
RUN curl https://sh.rustup.rs -sSf | sh -s -- \
-y \
--profile minimal \
-c rustfmt,clippy \
--default-toolchain $(cat rust-toolchain)
ENV PATH="/root/.cargo/bin:${PATH}"
# Point cargo to store data on the scratch volume.
ENV CARGO_TARGET_DIR=/workspace/scratch/cargo_target
ENV CARGO_HOME=/workspace/scratch/cargo_home
# Warms up the cargo registry cache for future cargo runs. Cargo will still
# update the cache using a git pull, but it only needs to download files that
# were changed since this image was built.
RUN cargo install thisiznotarealpackage -q || true
# We are building out of source with a readonly source filesystem. This flag
# tells some build.rs files to not write into the src filesystem.
ENV RUSTFLAGS='--cfg hermetic'
# All commands will be executed in the crosvm src directory.
WORKDIR /workspace/src/platform/crosvm