build(docker): update dockerfiles (#3085)

This commit is contained in:
ReenigneArcher 2024-08-24 22:39:48 -04:00 committed by GitHub
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 # artifacts: true
# platforms: linux/amd64 # platforms: linux/amd64
# archlinux does not have an arm64 base image # archlinux does not have an arm64 base image
@ -17,7 +17,7 @@ pacman -Syu --disable-download-timeout --noconfirm
pacman -Scc --noconfirm pacman -Scc --noconfirm
_DEPS _DEPS
FROM sunshine-base as sunshine-build FROM sunshine-base AS sunshine-build
ARG BRANCH ARG BRANCH
ARG BUILD_VERSION ARG BUILD_VERSION
@ -31,18 +31,19 @@ ENV COMMIT=${COMMIT}
SHELL ["/bin/bash", "-o", "pipefail", "-c"] 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 # hadolint ignore=SC2016
RUN sed -i 's,#MAKEFLAGS="-j2",MAKEFLAGS="-j$(nproc)",g' /etc/makepkg.conf RUN <<_SETUP
# install dependencies
RUN <<_DEPS
#!/bin/bash #!/bin/bash
set -e 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 \ pacman -Syu --disable-download-timeout --needed --noconfirm \
base-devel \ base-devel \
cmake \ cmake \
@ -51,7 +52,7 @@ pacman -Syu --disable-download-timeout --needed --noconfirm \
namcap \ namcap \
xorg-server-xvfb xorg-server-xvfb
pacman -Scc --noconfirm pacman -Scc --noconfirm
_DEPS _SETUP
# Setup builder user # Setup builder user
USER builder USER builder
@ -84,9 +85,11 @@ cmake \
_MAKE _MAKE
WORKDIR /build/sunshine/pkg WORKDIR /build/sunshine/pkg
RUN mv /build/sunshine/build/PKGBUILD . RUN <<_PACKAGE
RUN mv /build/sunshine/build/sunshine.install . mv /build/sunshine/build/PKGBUILD .
RUN makepkg --printsrcinfo > .SRCINFO mv /build/sunshine/build/sunshine.install .
makepkg --printsrcinfo > .SRCINFO
_PACKAGE
# create a PKGBUILD archive # create a PKGBUILD archive
USER root USER root
@ -111,12 +114,12 @@ rm -f /build/sunshine/pkg/sunshine-debug*.pkg.tar.zst
ls -a ls -a
_PKGBUILD _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/pkg/sunshine*.pkg.tar.zst /sunshine.pkg.tar.zst
COPY --link --from=sunshine-build /build/sunshine/sunshine.pkg.tar.gz /sunshine.pkg.tar.gz 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 / 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 # artifacts: false
# platforms: linux/amd64 # platforms: linux/amd64
# platforms_pr: linux/amd64 # platforms_pr: linux/amd64
@ -9,7 +9,7 @@ FROM ${BASE}:${TAG} AS toolchain-base
ENV DEBIAN_FRONTEND=noninteractive ENV DEBIAN_FRONTEND=noninteractive
FROM toolchain-base as toolchain FROM toolchain-base AS toolchain
ARG TARGETPLATFORM ARG TARGETPLATFORM
RUN echo "target_platform: ${TARGETPLATFORM}" RUN echo "target_platform: ${TARGETPLATFORM}"
@ -17,7 +17,9 @@ RUN echo "target_platform: ${TARGETPLATFORM}"
ENV DISPLAY=:0 ENV DISPLAY=:0
SHELL ["/bin/bash", "-o", "pipefail", "-c"] SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# install dependencies # install dependencies
# hadolint ignore=SC1091
RUN <<_DEPS RUN <<_DEPS
#!/bin/bash #!/bin/bash
set -e set -e
@ -59,20 +61,14 @@ apt-get install -y --no-install-recommends \
xvfb xvfb
apt-get clean apt-get clean
rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*
_DEPS
#Install Node # Install Node
# hadolint ignore=SC1091 wget --max-redirect=0 -qO- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
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
source "$HOME/.nvm/nvm.sh" source "$HOME/.nvm/nvm.sh"
nvm install "$node_version" nvm install node
nvm use "$node_version" nvm use node
nvm alias default "$node_version" nvm alias default node
_INSTALL_NODE _DEPS
# install cuda # install cuda
WORKDIR /build/cuda WORKDIR /build/cuda
@ -110,13 +106,13 @@ else
exec "\$@" exec "\$@"
fi fi
EOF EOF
_ENTRYPOINT
# Make the script executable # Make the script executable
RUN chmod +x /entrypoint.sh chmod +x /entrypoint.sh
# Note about CLion # 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 # Use the shell script as the entrypoint
ENTRYPOINT ["/entrypoint.sh"] ENTRYPOINT ["/entrypoint.sh"]

View file

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