build(Linux): Refactor Dockerfiles and build script for multi-stage, step-based builds (#4299)

This commit is contained in:
ReenigneArcher 2025-09-25 08:35:02 -04:00 • committed by GitHub
commit 9c1b8db5cd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 376 additions and 158 deletions

View file

@ -17,26 +17,11 @@ pacman -Syu --disable-download-timeout --noconfirm
pacman -Scc --noconfirm
_DEPS
FROM sunshine-base AS sunshine-build
ARG BRANCH
ARG BUILD_VERSION
ARG COMMIT
ARG CLONE_URL
# note: BUILD_VERSION may be blank
ENV BRANCH=${BRANCH}
ENV BUILD_VERSION=${BUILD_VERSION}
ENV COMMIT=${COMMIT}
ENV CLONE_URL=${CLONE_URL}
# PKGBUILD options
ENV _use_cuda=true
ENV _run_unit_tests=true
ENV _support_headless_testing=true
FROM sunshine-base AS sunshine-deps
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# Install dependencies first - this layer will be cached
RUN <<_SETUP
#!/bin/bash
set -e
@ -60,6 +45,26 @@ pacman -Syu --disable-download-timeout --needed --noconfirm \
pacman -Scc --noconfirm
_SETUP
FROM sunshine-deps AS sunshine-build
ARG BRANCH
ARG BUILD_VERSION
ARG COMMIT
ARG CLONE_URL
# note: BUILD_VERSION may be blank
ENV BRANCH=${BRANCH}
ENV BUILD_VERSION=${BUILD_VERSION}
ENV COMMIT=${COMMIT}
ENV CLONE_URL=${CLONE_URL}
# PKGBUILD options
ENV _use_cuda=true
ENV _run_unit_tests=true
ENV _support_headless_testing=true
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# Setup builder user
USER builder