Skip to content

Commit ffce833

Browse files
committed
feat: switch to new cs2.sh for launching cs2
* switch to use steam sniper runtime as base * use cs2.sh to launch cs2 Steam CMD stuff needs spinning out into a new build step or intermediate image.
1 parent 8737a6f commit ffce833

File tree

11 files changed

+25
-17
lines changed

11 files changed

+25
-17
lines changed

.github/workflows/docker-image.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ jobs:
1515
steps:
1616
- uses: actions/checkout@v3
1717
- name: Build the Docker image
18-
working-directory: ./bookworm
18+
working-directory: ./sniper
1919
run: docker build . --file Dockerfile --tag joedwards32/cs2:latest

.github/workflows/docker-publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ jobs:
7373
- name: Build and push Docker image
7474
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
7575
with:
76-
context: ./bookworm
77-
file: ./bookworm/Dockerfile
76+
context: ./sniper
77+
file: ./sniper/Dockerfile
7878
push: ${{ github.event_name != 'pull_request' }}
7979
tags: ${{ steps.meta.outputs.tags }}
8080
labels: ${{ steps.meta.outputs.labels }}

bookworm/hooks/build

Lines changed: 0 additions & 5 deletions
This file was deleted.
File renamed without changes.

bookworm/Dockerfile renamed to sniper/Dockerfile

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,16 @@
44

55
# BUILD STAGE
66

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

99
LABEL maintainer="[email protected]"
1010

11+
# TODO - Separate stage
12+
ARG PUID=1000
13+
ENV USER steam
14+
ENV HOMEDIR "/home/${USER}"
15+
ENV STEAMCMDDIR "${HOMEDIR}/steamcmd"
16+
1117
ENV STEAMAPPID 730
1218
ENV STEAMAPP cs2
1319
ENV STEAMAPPDIR "${HOMEDIR}/${STEAMAPP}-dedicated"
@@ -29,17 +35,22 @@ RUN set -x \
2935
libicu-dev \
3036
unzip \
3137
jq \
38+
&& useradd -u "${PUID}" -m "${USER}" \
3239
&& mkdir -p "${STEAMAPPDIR}" \
40+
&& mkdir -p "${STEAMCMDDIR}" \
3341
# Add entry script
3442
&& chmod +x "${HOMEDIR}/entry.sh" \
35-
&& chown -R "${USER}:${USER}" "${HOMEDIR}/entry.sh" "${STEAMAPPDIR}" \
43+
&& chown -R "${USER}:${USER}" "${HOMEDIR}" \
3644
# Clean up
3745
&& apt-get clean \
38-
&& find /var/lib/apt/lists/ -type f -delete
46+
&& find /var/lib/apt/lists/ -type f -delete \
47+
&& su "${USER}" -c \
48+
"curl -fsSL 'https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz' | tar xvzf - -C \"${STEAMCMDDIR}\" \
49+
&& \"./${STEAMCMDDIR}/steamcmd.sh\" +quit "\
3950

4051
# BASE
4152

42-
FROM build_stage AS bookworm-base
53+
FROM build_stage AS sniper-base
4354

4455
ENV CS2_SERVERNAME="cs2 private server" \
4556
CS2_CHEATS=0 \

bookworm/etc/entry.sh renamed to sniper/etc/entry.sh

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,6 @@ fi
5555
mkdir -p ~/.steam/sdk64
5656
ln -sfT ${STEAMCMDDIR}/linux64/steamclient.so ~/.steam/sdk64/steamclient.so
5757

58-
# FIX: extend linked library search path to include additional libs provided by valve
59-
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${STEAMAPPDIR}/bin/linuxsteamrt64"
60-
6158
# Install server.cfg
6259
mkdir -p $STEAMAPPDIR/game/csgo/cfg
6360
cp /etc/server.cfg "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg
@@ -132,7 +129,7 @@ if [[ ! -z $CS2_BOT_QUOTA_MODE ]] ; then
132129
fi
133130

134131
# Switch to server directory
135-
cd "${STEAMAPPDIR}/game/bin/linuxsteamrt64"
132+
cd "${STEAMAPPDIR}/game/"
136133

137134
# Pre Hook
138135
source "${STEAMAPPDIR}/pre.sh"
@@ -185,7 +182,7 @@ if [[ ! -z $CS2_RCON_PORT ]]; then
185182
fi
186183

187184
echo "Starting CS2 Dedicated Server"
188-
eval "./cs2" -dedicated \
185+
eval "./cs2.sh" -dedicated \
189186
"${CS2_IP_ARGS}" -port "${CS2_PORT}" \
190187
-console \
191188
-usercon \
File renamed without changes.
File renamed without changes.
File renamed without changes.

sniper/hooks/build

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
3+
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
4+
5+
docker build --target=sniper-base -t $DOCKER_REPO:latest -t $DOCKER_REPO:base ${SCRIPT_DIR}/..

0 commit comments

Comments
 (0)