Files
c3c/docker/Dockerfile
Manuel Barrio Linares 18ab18958b CI: add retries and package caching across all platforms
- Add retry loops to all package manager commands (apt, apk, pacman,
pkg).
- Implement daily package caching to minimize external server hits.
- Enable Docker layer caching in CI using buildx and GHA backend.
  - Sync CI Docker build steps with the build-with-docker.sh logic.
  - We don't, or more accurately, can't actually use
`build-with-docker.sh` anymore in CI. Maybe we should move it to
scripts/tools/ to keep the root directory clean.
- add ramdisk for BSD, shave 30/60 seconds.
- change BDSs to cross-platform-actions/action for a cleaner ci and skip
SLOW_TESTS for BSDs: this shaves a few seconds
- set global CACHE_INVALIDATION_SEED
2026-02-11 10:01:14 +01:00

45 lines
1.7 KiB
Docker

ARG UBUNTU_VERSION=22.04
FROM ubuntu:${UBUNTU_VERSION}
ARG LLVM_VERSION=18
ARG CMAKE_VERSION=3.20.0
# Prevent interactive prompts during apt install
ENV DEBIAN_FRONTEND=noninteractive
RUN for i in 1 2 3; do apt-get update && break || sleep 2; done && \
apt-get install -y --fix-missing \
wget gnupg software-properties-common lsb-release \
zlib1g zlib1g-dev python3 ninja-build curl g++ libcurl4-openssl-dev git && \
CODENAME=$(lsb_release -cs) && \
ARCH=$(uname -m) && \
wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-${ARCH}.sh && \
mkdir -p /opt/cmake && \
sh cmake-${CMAKE_VERSION}-linux-${ARCH}.sh --prefix=/opt/cmake --skip-license && \
ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake && \
rm cmake-${CMAKE_VERSION}-linux-${ARCH}.sh
RUN CODENAME=$(lsb_release -cs) && \
for i in 1 2; do wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key && break || sleep 2; done | apt-key add - && \
if [ "${LLVM_VERSION}" -ge 16 ]; then \
add-apt-repository "deb http://apt.llvm.org/${CODENAME}/ llvm-toolchain-${CODENAME}-${LLVM_VERSION} main"; \
else \
add-apt-repository "deb http://apt.llvm.org/${CODENAME}/ llvm-toolchain-${CODENAME} main"; \
fi && \
for i in 1 2 3; do apt-get update && break || sleep 2; done && \
apt-get install -y --fix-missing \
clang-${LLVM_VERSION} \
clang++-${LLVM_VERSION} \
llvm-${LLVM_VERSION} \
llvm-${LLVM_VERSION}-dev \
lld-${LLVM_VERSION} \
liblld-${LLVM_VERSION}-dev \
libpolly-${LLVM_VERSION}-dev && \
rm -rf /var/lib/apt/lists/*
RUN groupadd -g 1337 c3c && \
useradd -m -u 1337 -g c3c c3c
USER c3c
ENV PATH="/opt/cmake/bin:${PATH}"
WORKDIR /home/c3c