|
| 1 | +FROM ubuntu:26.04 |
| 2 | + |
| 3 | +# Install APT packages |
| 4 | +ARG DEBIAN_FRONTEND=noninteractive |
| 5 | +RUN apt-get update -q && apt-get -y -q install --no-install-recommends \ |
| 6 | + bzip2 \ |
| 7 | + ca-certificates \ |
| 8 | + ccache \ |
| 9 | + clang \ |
| 10 | + clang-tidy \ |
| 11 | + # For clang-apply-replacements, required by run-clang-tidy |
| 12 | + clang-tools \ |
| 13 | + clazy \ |
| 14 | + cmake \ |
| 15 | + curl \ |
| 16 | + dbus \ |
| 17 | + file \ |
| 18 | + g++ \ |
| 19 | + git \ |
| 20 | + googletest \ |
| 21 | + libc++-dev \ |
| 22 | + libc++abi-dev \ |
| 23 | + libdxflib-dev \ |
| 24 | + libdxflib3 \ |
| 25 | + libglu1-mesa-dev \ |
| 26 | + libgmock-dev \ |
| 27 | + libgtest-dev \ |
| 28 | + libmuparser-dev \ |
| 29 | + libmuparser2v5 \ |
| 30 | + libocct-*-dev \ |
| 31 | + libpolyclipping-dev \ |
| 32 | + libpolyclipping22 \ |
| 33 | + libqt6opengl6-dev \ |
| 34 | + libqt6openglwidgets6 \ |
| 35 | + libqt6sql6-sqlite \ |
| 36 | + libqt6svg6-dev \ |
| 37 | + # https://www.mail-archive.com/ubuntu-bugs@lists.ubuntu.com/msg6249494.html |
| 38 | + libstdc++-16-dev \ |
| 39 | + libtbb-dev \ |
| 40 | + libxi-dev \ |
| 41 | + make \ |
| 42 | + ninja-build \ |
| 43 | + occt-misc \ |
| 44 | + openssl \ |
| 45 | + pkg-config \ |
| 46 | + qt6-base-dev \ |
| 47 | + qt6-image-formats-plugins \ |
| 48 | + qt6-l10n-tools \ |
| 49 | + qt6-tools-dev \ |
| 50 | + qt6-tools-dev-tools \ |
| 51 | + wget \ |
| 52 | + xvfb \ |
| 53 | + zlib1g \ |
| 54 | + zlib1g-dev \ |
| 55 | + && rm -rf /var/lib/apt/lists/* |
| 56 | + |
| 57 | +# Install Rust |
| 58 | +# Make .cargo/ writable for everyone to allow running the container as non-root. |
| 59 | +ARG RUST_VERSION="1.95.0" |
| 60 | +ENV RUSTUP_HOME="/.rustup" \ |
| 61 | + CARGO_HOME="/.cargo" \ |
| 62 | + PATH="/.cargo/bin:$PATH" |
| 63 | +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \ |
| 64 | + | sh -s -- -y --default-toolchain $RUST_VERSION --profile minimal --no-modify-path \ |
| 65 | + && cargo install cargo-llvm-cov \ |
| 66 | + && chmod -R 777 $RUSTUP_HOME \ |
| 67 | + && chmod -R 777 $CARGO_HOME |
| 68 | + |
| 69 | +# Install UV |
| 70 | +# Set its python directory to a known, user-writable path to allow accessing the |
| 71 | +# python versions installed during docker build from within CI runs which are |
| 72 | +# run as non-root. |
| 73 | +ARG UV_VERSION="0.11.8" |
| 74 | +ARG UV_URL="https://github.com/astral-sh/uv/releases/download/$UV_VERSION/uv-x86_64-unknown-linux-gnu.tar.gz" |
| 75 | +ENV UV_PYTHON_INSTALL_DIR="/.uv/python" |
| 76 | +RUN wget -c "${UV_URL}" -O /tmp.tar.gz \ |
| 77 | + && tar -xzf /tmp.tar.gz --strip-components=1 -C /usr/local/bin/ \ |
| 78 | + && rm /tmp.tar.gz \ |
| 79 | + && mkdir -p $UV_PYTHON_INSTALL_DIR && chmod 777 $UV_PYTHON_INSTALL_DIR |
| 80 | + |
| 81 | +# Pre-install a Python version |
| 82 | +ARG PYTHON_VERSION="3.14" |
| 83 | +RUN uv python install $PYTHON_VERSION |
| 84 | + |
| 85 | +# Install ctcache (clang-tidy-cache) |
| 86 | +ARG CTCACHE_URL="https://github.com/matus-chochlik/ctcache/raw/0c7fee26e09ae8a393ed7d56164102da118ab23a/src/ctcache/clang_tidy_cache.py" |
| 87 | +ENV CTCACHE_CLANG_TIDY="/usr/bin/clang-tidy" \ |
| 88 | + CTCACHE_DIR="/.ctcache" \ |
| 89 | + CTCACHE_KEEP_COMMENTS=1 |
| 90 | +RUN wget -c "${CTCACHE_URL}" -O /usr/local/bin/ctcache.py \ |
| 91 | + && printf '#!/bin/bash\n/usr/local/bin/ctcache.py "${CTCACHE_CLANG_TIDY}" "${@}"\n' > /usr/local/bin/ctcache \ |
| 92 | + && chmod +x /usr/local/bin/ctcache.py /usr/local/bin/ctcache \ |
| 93 | + && mkdir "$CTCACHE_DIR" && chmod -R 777 "$CTCACHE_DIR" |
| 94 | + |
| 95 | +# Make ccache directory writable for everyone to allow running the container |
| 96 | +# as non-root. |
| 97 | +ENV CCACHE_DIR="/.ccache" |
| 98 | +RUN mkdir $CCACHE_DIR && chmod -R 777 $CCACHE_DIR |
| 99 | + |
| 100 | +# LibrePCB's unittests expect that there is a USERNAME environment variable |
| 101 | +ENV USERNAME="root" |
0 commit comments