build(docker): update dockerfiles (#3085)

This commit is contained in:
ReenigneArcher 2024-08-24 22:39:48 -04:00 committed by GitHub
parent 6593fa5d61
commit ddd67ce01d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 48 additions and 49 deletions

View File

@ -1,4 +1,4 @@
# syntax=docker/dockerfile:1.4
# syntax=docker/dockerfile:1
# artifacts: true
# platforms: linux/amd64
# archlinux does not have an arm64 base image
@ -17,7 +17,7 @@ pacman -Syu --disable-download-timeout --noconfirm
pacman -Scc --noconfirm
_DEPS
FROM sunshine-base as sunshine-build
FROM sunshine-base AS sunshine-build
ARG BRANCH
ARG BUILD_VERSION
@ -31,18 +31,19 @@ ENV COMMIT=${COMMIT}
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# Setup builder user, arch prevents running makepkg as root
RUN useradd -m builder && \
echo 'builder ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
# patch the build flags
# hadolint ignore=SC2016
RUN sed -i 's,#MAKEFLAGS="-j2",MAKEFLAGS="-j$(nproc)",g' /etc/makepkg.conf
# install dependencies
RUN <<_DEPS
RUN <<_SETUP
#!/bin/bash
set -e
# Setup builder user, arch prevents running makepkg as root
useradd -m builder
echo 'builder ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
# patch the build flags
sed -i 's,#MAKEFLAGS="-j2",MAKEFLAGS="-j$(nproc)",g' /etc/makepkg.conf
# install dependencies
pacman -Syu --disable-download-timeout --needed --noconfirm \
base-devel \
cmake \
@ -51,7 +52,7 @@ pacman -Syu --disable-download-timeout --needed --noconfirm \
namcap \
xorg-server-xvfb
pacman -Scc --noconfirm
_DEPS
_SETUP
# Setup builder user
USER builder
@ -84,9 +85,11 @@ cmake \
_MAKE
WORKDIR /build/sunshine/pkg
RUN mv /build/sunshine/build/PKGBUILD .
RUN mv /build/sunshine/build/sunshine.install .
RUN makepkg --printsrcinfo > .SRCINFO
RUN <<_PACKAGE
mv /build/sunshine/build/PKGBUILD .
mv /build/sunshine/build/sunshine.install .
makepkg --printsrcinfo > .SRCINFO
_PACKAGE
# create a PKGBUILD archive
USER root
@ -111,12 +114,12 @@ rm -f /build/sunshine/pkg/sunshine-debug*.pkg.tar.zst
ls -a
_PKGBUILD
FROM scratch as artifacts
FROM scratch AS artifacts
COPY --link --from=sunshine-build /build/sunshine/pkg/sunshine*.pkg.tar.zst /sunshine.pkg.tar.zst
COPY --link --from=sunshine-build /build/sunshine/sunshine.pkg.tar.gz /sunshine.pkg.tar.gz
FROM sunshine-base as sunshine
FROM sunshine-base AS sunshine
COPY --link --from=artifacts /sunshine.pkg.tar.zst /

View File

@ -1,4 +1,4 @@
# syntax=docker/dockerfile:1.4
# syntax=docker/dockerfile:1
# artifacts: false
# platforms: linux/amd64
# platforms_pr: linux/amd64
@ -9,7 +9,7 @@ FROM ${BASE}:${TAG} AS toolchain-base
ENV DEBIAN_FRONTEND=noninteractive
FROM toolchain-base as toolchain
FROM toolchain-base AS toolchain
ARG TARGETPLATFORM
RUN echo "target_platform: ${TARGETPLATFORM}"
@ -17,7 +17,9 @@ RUN echo "target_platform: ${TARGETPLATFORM}"
ENV DISPLAY=:0
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# install dependencies
# hadolint ignore=SC1091
RUN <<_DEPS
#!/bin/bash
set -e
@ -59,20 +61,14 @@ apt-get install -y --no-install-recommends \
xvfb
apt-get clean
rm -rf /var/lib/apt/lists/*
_DEPS
#Install Node
# hadolint ignore=SC1091
RUN <<_INSTALL_NODE
#!/bin/bash
set -e
node_version="20.9.0"
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
# Install Node
wget --max-redirect=0 -qO- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
source "$HOME/.nvm/nvm.sh"
nvm install "$node_version"
nvm use "$node_version"
nvm alias default "$node_version"
_INSTALL_NODE
nvm install node
nvm use node
nvm alias default node
_DEPS
# install cuda
WORKDIR /build/cuda
@ -110,13 +106,13 @@ else
exec "\$@"
fi
EOF
_ENTRYPOINT
# Make the script executable
RUN chmod +x /entrypoint.sh
chmod +x /entrypoint.sh
# Note about CLion
RUN echo "ATTENTION: CLion will override the entrypoint, you can disable this in the toolchain settings"
echo "ATTENTION: CLion will override the entrypoint, you can disable this in the toolchain settings"
_ENTRYPOINT
# Use the shell script as the entrypoint
ENTRYPOINT ["/entrypoint.sh"]

View File

@ -1,4 +1,4 @@
# syntax=docker/dockerfile:1.4
# syntax=docker/dockerfile:1
# artifacts: true
# platforms: linux/amd64,linux/arm64/v8
# platforms_pr: linux/amd64
@ -9,7 +9,7 @@ FROM ${BASE}:${TAG} AS sunshine-base
ENV DEBIAN_FRONTEND=noninteractive
FROM sunshine-base as sunshine-build
FROM sunshine-base AS sunshine-build
ARG BRANCH
ARG BUILD_VERSION
@ -57,7 +57,7 @@ ARG TAG
ARG TARGETARCH
COPY --link --from=sunshine-build /build/sunshine/build/cpack_artifacts/Sunshine.deb /sunshine-${BASE}-${TAG}-${TARGETARCH}.deb
FROM sunshine-base as sunshine
FROM sunshine-base AS sunshine
# copy deb from builder
COPY --link --from=artifacts /sunshine*.deb /sunshine.deb

View File

@ -1,4 +1,4 @@
# syntax=docker/dockerfile:1.4
# syntax=docker/dockerfile:1
# artifacts: true
# platforms: linux/amd64
# platforms_pr: linux/amd64
@ -7,7 +7,7 @@ ARG BASE=fedora
ARG TAG=39
FROM ${BASE}:${TAG} AS sunshine-base
FROM sunshine-base as sunshine-build
FROM sunshine-base AS sunshine-build
ARG BRANCH
ARG BUILD_VERSION
@ -55,7 +55,7 @@ ARG TAG
ARG TARGETARCH
COPY --link --from=sunshine-build /build/sunshine/build/cpack_artifacts/Sunshine.rpm /sunshine-${BASE}-${TAG}-${TARGETARCH}.rpm
FROM sunshine-base as sunshine
FROM sunshine-base AS sunshine
# copy deb from builder
COPY --link --from=artifacts /sunshine*.rpm /sunshine.rpm

View File

@ -1,4 +1,4 @@
# syntax=docker/dockerfile:1.4
# syntax=docker/dockerfile:1
# artifacts: true
# platforms: linux/amd64
# platforms_pr: linux/amd64
@ -7,7 +7,7 @@ ARG BASE=fedora
ARG TAG=40
FROM ${BASE}:${TAG} AS sunshine-base
FROM sunshine-base as sunshine-build
FROM sunshine-base AS sunshine-build
ARG BRANCH
ARG BUILD_VERSION
@ -55,7 +55,7 @@ ARG TAG
ARG TARGETARCH
COPY --link --from=sunshine-build /build/sunshine/build/cpack_artifacts/Sunshine.rpm /sunshine-${BASE}-${TAG}-${TARGETARCH}.rpm
FROM sunshine-base as sunshine
FROM sunshine-base AS sunshine
# copy deb from builder
COPY --link --from=artifacts /sunshine*.rpm /sunshine.rpm

View File

@ -1,4 +1,4 @@
# syntax=docker/dockerfile:1.4
# syntax=docker/dockerfile:1
# artifacts: true
# platforms: linux/amd64,linux/arm64/v8
# platforms_pr: linux/amd64
@ -9,7 +9,7 @@ FROM ${BASE}:${TAG} AS sunshine-base
ENV DEBIAN_FRONTEND=noninteractive
FROM sunshine-base as sunshine-build
FROM sunshine-base AS sunshine-build
ARG BRANCH
ARG BUILD_VERSION
@ -57,7 +57,7 @@ ARG TAG
ARG TARGETARCH
COPY --link --from=sunshine-build /build/sunshine/build/cpack_artifacts/Sunshine.deb /sunshine-${BASE}-${TAG}-${TARGETARCH}.deb
FROM sunshine-base as sunshine
FROM sunshine-base AS sunshine
# copy deb from builder
COPY --link --from=artifacts /sunshine*.deb /sunshine.deb

View File

@ -1,4 +1,4 @@
# syntax=docker/dockerfile:1.4
# syntax=docker/dockerfile:1
# artifacts: true
# platforms: linux/amd64,linux/arm64/v8
# platforms_pr: linux/amd64
@ -9,7 +9,7 @@ FROM ${BASE}:${TAG} AS sunshine-base
ENV DEBIAN_FRONTEND=noninteractive
FROM sunshine-base as sunshine-build
FROM sunshine-base AS sunshine-build
ARG BRANCH
ARG BUILD_VERSION
@ -57,7 +57,7 @@ ARG TAG
ARG TARGETARCH
COPY --link --from=sunshine-build /build/sunshine/build/cpack_artifacts/Sunshine.deb /sunshine-${BASE}-${TAG}-${TARGETARCH}.deb
FROM sunshine-base as sunshine
FROM sunshine-base AS sunshine
# copy deb from builder
COPY --link --from=artifacts /sunshine*.deb /sunshine.deb