2024-08-25 02:39:48 +00:00
|
|
|
# syntax=docker/dockerfile:1
|
2023-01-15 14:31:37 +00:00
|
|
|
# artifacts: true
|
|
|
|
# platforms: linux/amd64,linux/arm64/v8
|
2023-01-22 14:53:42 +00:00
|
|
|
# platforms_pr: linux/amd64
|
2023-02-20 20:03:03 +00:00
|
|
|
# no-cache-filters: sunshine-base,artifacts,sunshine
|
2023-01-15 14:31:37 +00:00
|
|
|
ARG BASE=ubuntu
|
|
|
|
ARG TAG=22.04
|
|
|
|
FROM ${BASE}:${TAG} AS sunshine-base
|
|
|
|
|
|
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
|
|
|
2024-08-25 02:39:48 +00:00
|
|
|
FROM sunshine-base AS sunshine-build
|
2023-01-15 14:31:37 +00:00
|
|
|
|
2023-03-09 23:13:57 +00:00
|
|
|
ARG BRANCH
|
|
|
|
ARG BUILD_VERSION
|
|
|
|
ARG COMMIT
|
|
|
|
# note: BUILD_VERSION may be blank
|
|
|
|
|
|
|
|
ENV BRANCH=${BRANCH}
|
|
|
|
ENV BUILD_VERSION=${BUILD_VERSION}
|
|
|
|
ENV COMMIT=${COMMIT}
|
|
|
|
|
2023-01-15 14:31:37 +00:00
|
|
|
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
|
|
|
|
|
|
|
# copy repository
|
|
|
|
WORKDIR /build/sunshine/
|
2023-02-20 20:03:03 +00:00
|
|
|
COPY --link .. .
|
2023-01-15 14:31:37 +00:00
|
|
|
|
|
|
|
# cmake and cpack
|
2024-08-04 00:04:26 +00:00
|
|
|
RUN <<_BUILD
|
2023-01-15 14:31:37 +00:00
|
|
|
#!/bin/bash
|
2023-02-13 20:27:51 +00:00
|
|
|
set -e
|
2024-08-04 00:04:26 +00:00
|
|
|
chmod +x ./scripts/linux_build.sh
|
2024-08-25 00:14:45 +00:00
|
|
|
./scripts/linux_build.sh \
|
|
|
|
--publisher-name='LizardByte' \
|
|
|
|
--publisher-website='https://app.lizardbyte.dev' \
|
|
|
|
--publisher-issue-url='https://app.lizardbyte.dev/support' \
|
|
|
|
--sudo-off
|
2024-08-04 00:04:26 +00:00
|
|
|
apt-get clean
|
|
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
_BUILD
|
2023-01-15 14:31:37 +00:00
|
|
|
|
2024-03-24 23:52:24 +00:00
|
|
|
# run tests
|
|
|
|
WORKDIR /build/sunshine/build/tests
|
|
|
|
# hadolint ignore=SC1091
|
|
|
|
RUN <<_TEST
|
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
export DISPLAY=:1
|
|
|
|
Xvfb ${DISPLAY} -screen 0 1024x768x24 &
|
|
|
|
./test_sunshine --gtest_color=yes
|
|
|
|
_TEST
|
|
|
|
|
2023-01-15 14:31:37 +00:00
|
|
|
FROM scratch AS artifacts
|
|
|
|
ARG BASE
|
|
|
|
ARG TAG
|
|
|
|
ARG TARGETARCH
|
2023-02-20 20:03:03 +00:00
|
|
|
COPY --link --from=sunshine-build /build/sunshine/build/cpack_artifacts/Sunshine.deb /sunshine-${BASE}-${TAG}-${TARGETARCH}.deb
|
2023-01-15 14:31:37 +00:00
|
|
|
|
2024-08-25 02:39:48 +00:00
|
|
|
FROM sunshine-base AS sunshine
|
2023-01-15 14:31:37 +00:00
|
|
|
|
|
|
|
# copy deb from builder
|
2023-02-20 20:03:03 +00:00
|
|
|
COPY --link --from=artifacts /sunshine*.deb /sunshine.deb
|
2023-01-15 14:31:37 +00:00
|
|
|
|
|
|
|
# install sunshine
|
|
|
|
RUN <<_INSTALL_SUNSHINE
|
|
|
|
#!/bin/bash
|
2023-02-13 20:27:51 +00:00
|
|
|
set -e
|
2023-01-15 14:31:37 +00:00
|
|
|
apt-get update -y
|
|
|
|
apt-get install -y --no-install-recommends /sunshine.deb
|
|
|
|
apt-get clean
|
|
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
_INSTALL_SUNSHINE
|
|
|
|
|
|
|
|
# network setup
|
|
|
|
EXPOSE 47984-47990/tcp
|
|
|
|
EXPOSE 48010
|
|
|
|
EXPOSE 47998-48000/udp
|
|
|
|
|
|
|
|
# setup user
|
|
|
|
ARG PGID=1000
|
|
|
|
ENV PGID=${PGID}
|
|
|
|
ARG PUID=1000
|
|
|
|
ENV PUID=${PUID}
|
|
|
|
ENV TZ="UTC"
|
|
|
|
ARG UNAME=lizard
|
|
|
|
ENV UNAME=${UNAME}
|
|
|
|
|
|
|
|
ENV HOME=/home/$UNAME
|
|
|
|
|
|
|
|
# setup user
|
|
|
|
RUN <<_SETUP_USER
|
2023-02-13 20:27:51 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
2023-01-15 14:31:37 +00:00
|
|
|
groupadd -f -g "${PGID}" "${UNAME}"
|
2023-04-07 22:14:50 +00:00
|
|
|
useradd -lm -d ${HOME} -s /bin/bash -g "${PGID}" -u "${PUID}" "${UNAME}"
|
2023-01-15 14:31:37 +00:00
|
|
|
mkdir -p ${HOME}/.config/sunshine
|
|
|
|
ln -s ${HOME}/.config/sunshine /config
|
|
|
|
chown -R ${UNAME} ${HOME}
|
|
|
|
_SETUP_USER
|
|
|
|
|
|
|
|
USER ${UNAME}
|
|
|
|
WORKDIR ${HOME}
|
|
|
|
|
|
|
|
# entrypoint
|
|
|
|
ENTRYPOINT ["/usr/bin/sunshine"]
|