Skip to content

Commit 21e5b7e

Browse files
committed
feat: split sniper steamcmd and cs2 into separate build stages
1 parent ffce833 commit 21e5b7e

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

sniper/Dockerfile

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
# Dockerfile that builds a CS2 Gameserver
33
###########################################################
44

5-
# BUILD STAGE
5+
# SteamCMD Stage
66

7-
FROM registry.gitlab.steamos.cloud/steamrt/sniper/platform as build_stage
7+
FROM registry.gitlab.steamos.cloud/steamrt/sniper/platform as steamcmd
88

99
LABEL maintainer="[email protected]"
1010

@@ -14,16 +14,6 @@ ENV USER steam
1414
ENV HOMEDIR "/home/${USER}"
1515
ENV STEAMCMDDIR "${HOMEDIR}/steamcmd"
1616

17-
ENV STEAMAPPID 730
18-
ENV STEAMAPP cs2
19-
ENV STEAMAPPDIR "${HOMEDIR}/${STEAMAPP}-dedicated"
20-
ENV STEAMAPPVALIDATE 0
21-
22-
COPY etc/entry.sh "${HOMEDIR}/entry.sh"
23-
COPY etc/server.cfg "/etc/server.cfg"
24-
COPY etc/pre.sh "/etc/pre.sh"
25-
COPY etc/post.sh "/etc/post.sh"
26-
2717
RUN set -x \
2818
# Install, update & upgrade packages
2919
&& apt-get update \
@@ -36,21 +26,29 @@ RUN set -x \
3626
unzip \
3727
jq \
3828
&& useradd -u "${PUID}" -m "${USER}" \
39-
&& mkdir -p "${STEAMAPPDIR}" \
4029
&& mkdir -p "${STEAMCMDDIR}" \
4130
# Add entry script
42-
&& chmod +x "${HOMEDIR}/entry.sh" \
4331
&& chown -R "${USER}:${USER}" "${HOMEDIR}" \
4432
# Clean up
4533
&& apt-get clean \
4634
&& find /var/lib/apt/lists/ -type f -delete \
4735
&& su "${USER}" -c \
4836
"curl -fsSL 'https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz' | tar xvzf - -C \"${STEAMCMDDIR}\" \
49-
&& \"./${STEAMCMDDIR}/steamcmd.sh\" +quit "\
37+
&& \"./${STEAMCMDDIR}/steamcmd.sh\" +quit "
5038

51-
# BASE
39+
# CS2
5240

53-
FROM build_stage AS sniper-base
41+
FROM steamcmd AS cs2
42+
43+
ENV STEAMAPPID 730
44+
ENV STEAMAPP cs2
45+
ENV STEAMAPPDIR "${HOMEDIR}/${STEAMAPP}-dedicated"
46+
ENV STEAMAPPVALIDATE 0
47+
48+
COPY etc/entry.sh "${HOMEDIR}/entry.sh"
49+
COPY etc/server.cfg "/etc/server.cfg"
50+
COPY etc/pre.sh "/etc/pre.sh"
51+
COPY etc/post.sh "/etc/post.sh"
5452

5553
ENV CS2_SERVERNAME="cs2 private server" \
5654
CS2_CHEATS=0 \
@@ -84,6 +82,8 @@ ENV CS2_SERVERNAME="cs2 private server" \
8482
# Set permissions on STEAMAPPDIR
8583
# Permissions may need to be reset if persistent volume mounted
8684
RUN set -x \
85+
&& mkdir -p "${STEAMAPPDIR}" \
86+
&& chmod +x "${HOMEDIR}/entry.sh" \
8787
&& chown -R "${USER}:${USER}" "${STEAMAPPDIR}" \
8888
&& chmod 0777 "${STEAMAPPDIR}"
8989

0 commit comments

Comments
 (0)