|
| 1 | +# Dockerfile for building container images for use in the EDK2 CI. |
| 2 | +# |
| 3 | +# Copyright (C) 2025, Red Hat, Inc. |
| 4 | +# SPDX-License-Identifier: BSD-2-Clause-Patent |
| 5 | +# |
| 6 | +# This file contains the definitions for images to be used for different |
| 7 | +# jobs in the EDK2 CI pipeline. The set of tools and dependencies is split into |
| 8 | +# multiple images to reduce the overall download size by providing images |
| 9 | +# tailored to the task of the CI job. Currently there are two images: "build" |
| 10 | +# and "test". |
| 11 | +# The images are intended to run on x86_64. |
| 12 | + |
| 13 | + |
| 14 | +# Build Image |
| 15 | +# This image is intended for jobs that compile the source code and as a general |
| 16 | +# purpose image. It contains the toolchains for all supported architectures, and |
| 17 | +# all build dependencies. |
| 18 | +FROM registry.fedoraproject.org/fedora:43 AS build |
| 19 | + |
| 20 | +ARG CSPELL_VERSION=9.3.0 |
| 21 | +ARG MARKDOWNLINT_VERSION=0.44.0 |
| 22 | +ARG POWERSHELL_VERSION=7.5.4 |
| 23 | +ARG DOTNET_VERSION=9.0 |
| 24 | +RUN --mount=type=cache,target=/var/cache/libdnf5,sharing=locked \ |
| 25 | + dnf \ |
| 26 | + --assumeyes \ |
| 27 | + --nodocs \ |
| 28 | + --setopt=install_weak_deps=0 \ |
| 29 | + install \ |
| 30 | + acpica-tools \ |
| 31 | + dotnet-runtime-${DOTNET_VERSION} \ |
| 32 | + curl \ |
| 33 | + gcc-c++ \ |
| 34 | + gcc \ |
| 35 | + gcc-aarch64-linux-gnu \ |
| 36 | + gcc-arm-linux-gnu \ |
| 37 | + gcc-riscv64-linux-gnu \ |
| 38 | + gcc-loongarch64-linux-gnu \ |
| 39 | + git \ |
| 40 | + lcov \ |
| 41 | + libX11-devel \ |
| 42 | + libXext-devel \ |
| 43 | + libuuid-devel \ |
| 44 | + libasan \ |
| 45 | + libubsan \ |
| 46 | + make \ |
| 47 | + nuget \ |
| 48 | + nasm \ |
| 49 | + https://github.com/PowerShell/PowerShell/releases/download/v${POWERSHELL_VERSION}/powershell-${POWERSHELL_VERSION}-1.rh.x86_64.rpm \ |
| 50 | + python3 \ |
| 51 | + python3-distutils-extra \ |
| 52 | + python3-pip \ |
| 53 | + python3-devel \ |
| 54 | + nodejs \ |
| 55 | + npm \ |
| 56 | + tar \ |
| 57 | + sudo |
| 58 | +RUN alternatives --install /usr/bin/python python /usr/bin/python3 1 |
| 59 | + |
| 60 | +# Preinstall python + dependencies as virtual environment |
| 61 | +RUN --mount=type=cache,target=/var/cache/libdnf5,sharing=locked \ |
| 62 | + dnf \ |
| 63 | + --assumeyes \ |
| 64 | + --nodocs \ |
| 65 | + --setopt=install_weak_deps=0 \ |
| 66 | + install \ |
| 67 | + python3 \ |
| 68 | + python3-virtualenv |
| 69 | +RUN virtualenv=/opt/venv |
| 70 | +ENV VIRTUAL_ENV=/opt/venv |
| 71 | +ENV PATH=/opt/venv/bin:$PATH |
| 72 | +RUN --mount=type=cache,target=/root/.cache/pip \ |
| 73 | + pip install --upgrade pip \ |
| 74 | + -r "https://raw.githubusercontent.com/tianocore/edk2/master/pip-requirements.txt" |
| 75 | + |
| 76 | +RUN --mount=type=cache,target=/root/.cache/pip \ |
| 77 | + pip install --upgrade pip lcov_cobertura setuptools |
| 78 | + |
| 79 | +# Set toolchains prefix |
| 80 | +ENV GCC_AARCH64_PREFIX=/usr/bin/aarch64-linux-gnu- |
| 81 | +ENV GCC_ARM_PREFIX=/usr/bin/arm-linux-gnu- |
| 82 | +ENV GCC_RISCV64_PREFIX=/usr/bin/riscv64-linux-gnu- |
| 83 | +ENV GCC_LOONGARCH64_PREFIX=/usr/bin/loongarch64-linux-gnu- |
| 84 | +# - Also set GCC5, which is deprecated, but still in use. |
| 85 | +ENV GCC5_AARCH64_PREFIX=/usr/bin/aarch64-linux-gnu- |
| 86 | +ENV GCC5_ARM_PREFIX=/usr/bin/arm-linux-gnu- |
| 87 | +ENV GCC5_RISCV64_PREFIX=/usr/bin/riscv64-linux-gnu- |
| 88 | +ENV GCC5_LOONGARCH64_PREFIX=/usr/bin/loongarch64-linux-gnu- |
| 89 | + |
| 90 | +# Tools used by build extensions. |
| 91 | +RUN --mount=type=cache,target=/root/.npm \ |
| 92 | + npm install -g npm \ |
| 93 | + cspell@${CSPELL_VERSION} \ |
| 94 | + markdownlint-cli@${MARKDOWNLINT_VERSION} |
| 95 | + |
| 96 | +# Test Image |
| 97 | +# This image is intended for jobs that run tests (and possibly also build) |
| 98 | +# firmware images. It is based on the build image and adds Qemu for the |
| 99 | +# architectures under test. |
| 100 | + |
| 101 | +FROM build AS test |
| 102 | +RUN --mount=type=cache,target=/var/cache/libdnf5,sharing=locked \ |
| 103 | + dnf \ |
| 104 | + --assumeyes \ |
| 105 | + --nodocs \ |
| 106 | + --setopt=install_weak_deps=0 \ |
| 107 | + install \ |
| 108 | + qemu-system-arm \ |
| 109 | + qemu-system-aarch64 \ |
| 110 | + qemu-system-loongarch64 \ |
| 111 | + qemu-system-x86 \ |
| 112 | + qemu-system-riscv \ |
| 113 | + qemu-ui-gtk |
| 114 | + |
| 115 | +# Dev Image |
| 116 | +# This image is intended for local use. This builds on the test image but adds |
| 117 | +# tools for local developers. |
| 118 | +FROM test AS dev |
| 119 | +ENV GCM_LINK=https://github.com/git-ecosystem/git-credential-manager/releases/download/v2.6.0/gcm-linux_amd64.2.6.0.tar.gz |
| 120 | +RUN --mount=type=cache,target=/var/cache/libdnf5,sharing=locked \ |
| 121 | + dnf \ |
| 122 | + --assumeyes \ |
| 123 | + --nodocs \ |
| 124 | + --setopt=install_weak_deps=0 \ |
| 125 | + install \ |
| 126 | + libicu \ |
| 127 | + clang \ |
| 128 | + curl \ |
| 129 | + lld \ |
| 130 | + llvm \ |
| 131 | + tar \ |
| 132 | + vim \ |
| 133 | + nano |
| 134 | + |
| 135 | +# Setup the git credential manager for developer credentials. |
| 136 | +RUN curl -L "${GCM_LINK}" | tar -xz -C /usr/local/bin |
| 137 | +RUN git-credential-manager configure |
| 138 | +RUN git config --global credential.credentialStore cache |
| 139 | +RUN cp /etc/skel/.bashrc /root/.bashrc |
| 140 | + |
| 141 | +# Set the entry point |
| 142 | +COPY fedora43_dev_entrypoint.sh /usr/libexec/entrypoint |
| 143 | +ENTRYPOINT ["/usr/libexec/entrypoint"] |
0 commit comments