Skip to content

Commit 36b6d13

Browse files
Refactor Dockerfiles and update .dockerignore
Simplifies multi-stage Dockerfiles for Debian Trixie and Ubuntu by removing redundant native dependency stages and unifying build logic. Updates .dockerignore to remove exceptions for .rstcheck.cfg, add ignores for node_modules and non-Linux third-party dependencies, and deletes the unused .rstcheck.cfg config file.
1 parent 7c12a73 commit 36b6d13

File tree

5 files changed

+34
-52
lines changed

5 files changed

+34
-52
lines changed

.dockerignore

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
# do not ignore .git, needed for versioning
55
!/.git
66

7-
# do not ignore .rstcheck.cfg, needed to test building docs
8-
!/.rstcheck.cfg
9-
107
# ignore repo directories and files
118
docker/
129
gh-pages-template/
@@ -20,7 +17,17 @@ crowdin.yml
2017
# ignore dev directories
2118
build/
2219
cmake-*/
20+
node_modules/
2321
venv/
2422

23+
# ignore pre-built deps for other platforms
24+
third-party/build-deps/dist/Darwin*
25+
third-party/build-deps/dist/FreeBSD*
26+
third-party/build-deps/dist/Windows*
27+
28+
# ignore non Linux third-party submodules
29+
third-party/libdisplaydevice
30+
third-party/TPCircularBuffer
31+
2532
# ignore artifacts
2633
artifacts/

.rstcheck.cfg

Lines changed: 0 additions & 10 deletions
This file was deleted.

docker/debian-trixie.dockerfile

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,8 @@ FROM ${BASE}:${TAG} AS sunshine-base
99

1010
ENV DEBIAN_FRONTEND=noninteractive
1111

12-
FROM sunshine-base AS sunshine-deps
13-
14-
ARG BUILDPLATFORM
15-
ARG TARGETPLATFORM
16-
1712
# Force this stage to run on the build platform for cross-compilation setup
18-
FROM --platform=$BUILDPLATFORM debian:trixie AS sunshine-deps-native
13+
FROM --platform=$BUILDPLATFORM ${BASE}:${TAG} AS sunshine-deps
1914

2015
ENV DEBIAN_FRONTEND=noninteractive
2116

@@ -41,19 +36,19 @@ if [ "${BUILDPLATFORM}" != "${TARGETPLATFORM}" ]; then
4136
target_tuple="x86_64-linux-gnu"
4237
;;
4338
linux/arm64)
44-
target_arch="arm64"
39+
target_arch="arm64"
4540
target_tuple="aarch64-linux-gnu"
4641
;;
4742
*)
4843
echo "Unsupported target platform: ${TARGETPLATFORM}"
4944
exit 1
5045
;;
5146
esac
52-
47+
5348
# Enable multiarch support for cross-compilation
5449
dpkg --add-architecture ${target_arch}
5550
apt-get update
56-
51+
5752
echo "Cross-compiling from ${BUILDPLATFORM} to ${TARGETPLATFORM}"
5853
echo "Target arch: ${target_arch}, Target triple: ${target_tuple}"
5954
else
@@ -74,7 +69,7 @@ apt-get clean
7469
rm -rf /var/lib/apt/lists/*
7570
_DEPS
7671

77-
FROM --platform=$BUILDPLATFORM sunshine-deps-native AS sunshine-build
72+
FROM --platform=$BUILDPLATFORM sunshine-deps AS sunshine-build
7873

7974
ARG BUILDPLATFORM
8075
ARG TARGETPLATFORM
@@ -95,7 +90,7 @@ RUN <<_BUILD
9590
#!/bin/bash
9691
set -e
9792

98-
# Set up cross-compilation variables if building for different platform
93+
# Set up cross-compilation variables if building for different platform
9994
if [ "${BUILDPLATFORM}" != "${TARGETPLATFORM}" ]; then
10095
cross_compile="--cross-compile"
10196
case "${TARGETPLATFORM}" in
@@ -152,7 +147,7 @@ fi
152147
${target_tuple:+--target-tuple=${target_tuple}}
153148
_BUILD
154149

155-
FROM --platform=$TARGETPLATFORM sunshine-build AS sunshine-test
150+
FROM sunshine-build AS sunshine-test
156151

157152
# This stage runs on the target architecture to avoid qemu overhead for tests
158153
ARG TARGETPLATFORM
@@ -167,7 +162,7 @@ Xvfb ${DISPLAY} -screen 0 1024x768x24 &
167162
./test_sunshine --gtest_color=yes
168163
_TEST
169164

170-
FROM --platform=$TARGETPLATFORM sunshine-base AS sunshine
165+
FROM sunshine-base AS sunshine
171166

172167
ARG BASE
173168
ARG TAG

docker/ubuntu-22.04.dockerfile

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,8 @@ FROM ${BASE}:${TAG} AS sunshine-base
99

1010
ENV DEBIAN_FRONTEND=noninteractive
1111

12-
FROM sunshine-base AS sunshine-deps
13-
14-
ARG BUILDPLATFORM
15-
ARG TARGETPLATFORM
16-
1712
# Force this stage to run on the build platform for cross-compilation setup
18-
FROM --platform=$BUILDPLATFORM ubuntu:22.04 AS sunshine-deps-native
13+
FROM --platform=$BUILDPLATFORM ${BASE}:${TAG} AS sunshine-deps
1914

2015
ENV DEBIAN_FRONTEND=noninteractive
2116

@@ -40,19 +35,19 @@ if [ "${BUILDPLATFORM}" != "${TARGETPLATFORM}" ]; then
4035
target_tuple="x86_64-linux-gnu"
4136
;;
4237
linux/arm64)
43-
target_arch="arm64"
38+
target_arch="arm64"
4439
target_tuple="aarch64-linux-gnu"
4540
;;
4641
*)
4742
echo "Unsupported target platform: ${TARGETPLATFORM}"
4843
exit 1
4944
;;
5045
esac
51-
46+
5247
# Enable multiarch support for cross-compilation
5348
dpkg --add-architecture ${target_arch}
5449
apt-get update
55-
50+
5651
echo "Cross-compiling from ${BUILDPLATFORM} to ${TARGETPLATFORM}"
5752
echo "Target arch: ${target_arch}, Target triple: ${target_tuple}"
5853
else
@@ -73,7 +68,7 @@ apt-get clean
7368
rm -rf /var/lib/apt/lists/*
7469
_DEPS
7570

76-
FROM --platform=$BUILDPLATFORM sunshine-deps-native AS sunshine-build
71+
FROM --platform=$BUILDPLATFORM sunshine-deps AS sunshine-build
7772

7873
ARG BUILDPLATFORM
7974
ARG TARGETPLATFORM
@@ -94,7 +89,7 @@ RUN <<_BUILD
9489
#!/bin/bash
9590
set -e
9691

97-
# Set up cross-compilation variables if building for different platform
92+
# Set up cross-compilation variables if building for different platform
9893
if [ "${BUILDPLATFORM}" != "${TARGETPLATFORM}" ]; then
9994
cross_compile="--cross-compile"
10095
case "${TARGETPLATFORM}" in
@@ -151,7 +146,7 @@ fi
151146
${target_tuple:+--target-tuple=${target_tuple}}
152147
_BUILD
153148

154-
FROM --platform=$TARGETPLATFORM sunshine-build AS sunshine-test
149+
FROM sunshine-build AS sunshine-test
155150

156151
# This stage runs on the target architecture to avoid qemu overhead for tests
157152
ARG TARGETPLATFORM
@@ -166,7 +161,7 @@ Xvfb ${DISPLAY} -screen 0 1024x768x24 &
166161
./test_sunshine --gtest_color=yes
167162
_TEST
168163

169-
FROM --platform=$TARGETPLATFORM sunshine-base AS sunshine
164+
FROM sunshine-base AS sunshine
170165

171166
ARG BASE
172167
ARG TAG

docker/ubuntu-24.04.dockerfile

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,8 @@ FROM ${BASE}:${TAG} AS sunshine-base
99

1010
ENV DEBIAN_FRONTEND=noninteractive
1111

12-
FROM sunshine-base AS sunshine-deps
13-
14-
ARG BUILDPLATFORM
15-
ARG TARGETPLATFORM
16-
1712
# Force this stage to run on the build platform for cross-compilation setup
18-
FROM --platform=$BUILDPLATFORM ubuntu:24.04 AS sunshine-deps-native
13+
FROM --platform=$BUILDPLATFORM ${BASE}:${TAG} AS sunshine-deps
1914

2015
ENV DEBIAN_FRONTEND=noninteractive
2116

@@ -40,19 +35,19 @@ if [ "${BUILDPLATFORM}" != "${TARGETPLATFORM}" ]; then
4035
target_tuple="x86_64-linux-gnu"
4136
;;
4237
linux/arm64)
43-
target_arch="arm64"
38+
target_arch="arm64"
4439
target_tuple="aarch64-linux-gnu"
4540
;;
4641
*)
4742
echo "Unsupported target platform: ${TARGETPLATFORM}"
4843
exit 1
4944
;;
5045
esac
51-
46+
5247
# Enable multiarch support for cross-compilation
5348
dpkg --add-architecture ${target_arch}
5449
apt-get update
55-
50+
5651
echo "Cross-compiling from ${BUILDPLATFORM} to ${TARGETPLATFORM}"
5752
echo "Target arch: ${target_arch}, Target triple: ${target_tuple}"
5853
else
@@ -72,7 +67,7 @@ apt-get clean
7267
rm -rf /var/lib/apt/lists/*
7368
_DEPS
7469

75-
FROM --platform=$BUILDPLATFORM sunshine-deps-native AS sunshine-build
70+
FROM --platform=$BUILDPLATFORM sunshine-deps AS sunshine-build
7671

7772
ARG BUILDPLATFORM
7873
ARG TARGETPLATFORM
@@ -93,7 +88,7 @@ RUN <<_BUILD
9388
#!/bin/bash
9489
set -e
9590

96-
# Set up cross-compilation variables if building for different platform
91+
# Set up cross-compilation variables if building for different platform
9792
if [ "${BUILDPLATFORM}" != "${TARGETPLATFORM}" ]; then
9893
cross_compile="--cross-compile"
9994
case "${TARGETPLATFORM}" in
@@ -150,7 +145,7 @@ fi
150145
${target_tuple:+--target-tuple=${target_tuple}}
151146
_BUILD
152147

153-
FROM --platform=$TARGETPLATFORM sunshine-build AS sunshine-test
148+
FROM sunshine-build AS sunshine-test
154149

155150
# This stage runs on the target architecture to avoid qemu overhead for tests
156151
ARG TARGETPLATFORM
@@ -165,7 +160,7 @@ Xvfb ${DISPLAY} -screen 0 1024x768x24 &
165160
./test_sunshine --gtest_color=yes
166161
_TEST
167162

168-
FROM --platform=$TARGETPLATFORM sunshine-base AS sunshine
163+
FROM sunshine-base AS sunshine
169164

170165
ARG BASE
171166
ARG TAG

0 commit comments

Comments
 (0)