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. 4ARG RUST_VERSION 5FROM docker.io/rust:${RUST_VERSION}-slim-bullseye 6 7# Use a dedicated target directory so we do not write into the source directory. 8RUN mkdir -p /scratch/cargo_target 9ENV CARGO_TARGET_DIR=/scratch/cargo_target 10 11# Prevent the container from writing root-owned __pycache__ files into the src. 12ENV PYTHONDONTWRITEBYTECODE=1 13 14# Add foreign architectures for cross-compilation. 15RUN dpkg --add-architecture arm64 \ 16 && dpkg --add-architecture armhf 17 18# Install dependencies for native builds. 19COPY tools/install-deps /tools/ 20RUN apt-get update \ 21 && apt-get install --yes sudo \ 22 && /tools/install-deps \ 23 # Clear apt cache to save space in layer. 24 && rm -rf /var/lib/apt/lists/* \ 25 # Delete build artifacts from 'cargo install' to save space in layer. 26 && rm -rf /scratch/cargo_target/* 27 28# Prepare wine64 29RUN ln -sf /usr/bin/wine64-stable /usr/bin/wine64 \ 30 && wine64 wineboot 31 32# Install cross-compilation dependencies. 33COPY tools/install-aarch64-deps tools/install-armhf-deps /tools/ 34 35RUN apt-get update \ 36 && /tools/install-aarch64-deps \ 37 && /tools/install-armhf-deps \ 38 # Clear apt cache to save space in layer. 39 && rm -rf /var/lib/apt/lists/* 40 41# Prebuild aarch64 VM image for faster startup. 42COPY tools/aarch64vm /tools/ 43COPY /tools/impl/testvm.py /tools/impl/ 44COPY /tools/impl/testvm/version /tools/impl/testvm/ 45RUN /tools/aarch64vm build 46 47VOLUME /workspace 48WORKDIR /workspace 49