Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(docker): update dockerfiles #3085

Merged
merged 1 commit into from
Aug 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 18 additions & 15 deletions docker/archlinux.dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -31,18 +31,19 @@ ENV COMMIT=${COMMIT}

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

# hadolint ignore=SC2016
RUN <<_SETUP
#!/bin/bash
set -e

# Setup builder user, arch prevents running makepkg as root
RUN useradd -m builder && \
echo 'builder ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
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
sed -i 's,#MAKEFLAGS="-j2",MAKEFLAGS="-j$(nproc)",g' /etc/makepkg.conf

# install dependencies
RUN <<_DEPS
#!/bin/bash
set -e
pacman -Syu --disable-download-timeout --needed --noconfirm \
base-devel \
cmake \
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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 /

Expand Down
30 changes: 13 additions & 17 deletions docker/clion-toolchain.dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# syntax=docker/dockerfile:1.4
# syntax=docker/dockerfile:1
# artifacts: false
# platforms: linux/amd64
# platforms_pr: linux/amd64
Expand All @@ -9,15 +9,17 @@ 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}"

ENV DISPLAY=:0

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

# install dependencies
# hadolint ignore=SC1091
RUN <<_DEPS
#!/bin/bash
set -e
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"]
6 changes: 3 additions & 3 deletions docker/debian-bookworm.dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions docker/fedora-39.dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# syntax=docker/dockerfile:1.4
# syntax=docker/dockerfile:1
# artifacts: true
# platforms: linux/amd64
# platforms_pr: linux/amd64
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions docker/fedora-40.dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# syntax=docker/dockerfile:1.4
# syntax=docker/dockerfile:1
# artifacts: true
# platforms: linux/amd64
# platforms_pr: linux/amd64
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions docker/ubuntu-22.04.dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions docker/ubuntu-24.04.dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
Loading