Skip to content

Commit

Permalink
Add mods (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeyShorokhov authored Apr 1, 2024
2 parents f400556 + 50d7de4 commit 455f96d
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 30 deletions.
27 changes: 15 additions & 12 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
- cron: '0 0 * * 0'

env:
DOCKER_IMAGE: ${{ secrets.DOCKER_USERNAME }}/hlds
DOCKER_IMAGE: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PLATFORMS: linux/amd64

jobs:
Expand All @@ -21,12 +21,12 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
branch: [steam_legacy, latest]
include:
- branch: steam_legacy
build-args: APPBRANCH=steam_legacy
- branch: latest
build-args: APPBRANCH=
branch:
- steam_legacy
- public
mod:
- valve
- cstrike

steps:
- uses: actions/[email protected]
Expand All @@ -36,11 +36,12 @@ jobs:

- name: Cache Docker layers
uses: actions/[email protected]
env:
KEY: ${{ matrix.mod }}-${{ matrix.branch }}
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}-${{ matrix.branch }}
restore-keys: |
${{ runner.os }}-buildx-${{ matrix.branch }}
key: ${{ runner.os }}-buildx-${{ github.sha }}-${{ env.KEY }}
restore-keys: ${{ runner.os }}-buildx-${{ env.KEY }}

- name: Log in to Docker Hub
if: github.ref == 'refs/heads/master'
Expand All @@ -56,7 +57,9 @@ jobs:
file: ./Dockerfile
platforms: ${{ env.DOCKER_PLATFORMS }}
push: ${{ github.ref == 'refs/heads/master' }}
tags: ${{ env.DOCKER_IMAGE }}:${{ matrix.branch }}
build-args: ${{ matrix.build-args }}
tags: ${{ secrets.DOCKER_USERNAME }}/${{ matrix.mod }}:${{ matrix.branch }}
build-args: |
APPBRANCH=${{ matrix.branch }}
MOD=${{ matrix.mod }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
18 changes: 15 additions & 3 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"dockerBuild": {
"context": "${workspaceFolder}",
"buildArgs": {
"APPBRANCH": "${input:betaBranch}"
"APPBRANCH": "${input:betaBranch}",
"MOD": "${input:mod}",
},
"tag": "hlds_image"
},
Expand All @@ -29,12 +30,23 @@
{
"type": "pickString",
"id": "betaBranch",
"default": "true",
"default": "public",
"description": "Select DepotsDownloader branch.",
"options": [
"public",
"steam_legacy"
]
}
},
{
"type": "pickString",
"id": "mod",
"default": "valve",
"description": "Select mod.",
"options": [
"valve",
"cstrike",
"czero"
]
},
]
}
32 changes: 17 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ARG APPDIR="/root/hlds"
ARG APPID="90"
ARG MOD="valve"

FROM debian:bookworm-slim AS build_stage
FROM debian:trixie-slim AS build_stage

ARG APPDIR
ARG APPID
Expand All @@ -13,21 +13,23 @@ LABEL creator="Sergey Shorokhov <[email protected]>"

# Install required packages
RUN set -x \
&& apt-get update \
&& apt-get install -y --no-install-recommends --no-install-suggests \
ca-certificates=20230311 \
curl=7.88.1-10+deb12u5 \
libarchive-tools=3.6.2-1 \
&& apt update \
&& apt install -y --no-install-recommends --no-install-suggests \
ca-certificates=20240203 \
curl=8.5.0-2 \
libarchive-tools=3.7.2-1 \
&& rm -rf /var/lib/apt/lists/*

# Download and install DepotDownloader
ARG DepotDownloader_URL="https://github.com/SteamRE/DepotDownloader/releases/download/DepotDownloader_2.5.0/DepotDownloader-linux-x64.zip"
RUN curl -L# ${DepotDownloader_URL} | bsdtar -xvf - -C /usr/local/bin/ \
&& chmod +x /usr/local/bin/DepotDownloader

# Download required depots
ARG DEPOTS="1 4 1006"
RUN for depot in ${DEPOTS}; do \
COPY --chmod=755 utils/* utils/

# Download mod depots
RUN DEPOTS=$(utils/getDepotsByMod.sh ${MOD}) \
&& for depot in ${DEPOTS}; do \
DepotDownloader -dir ${APPDIR} -app ${APPID} -depot ${depot} -beta ${APPBRANCH}; \
done \
&& rm -rf ${APPDIR}/.DepotDownloader
Expand All @@ -43,15 +45,15 @@ RUN rm -rf ${APPDIR}/linux64 \
-name '*.dylib' \
\) -exec rm -rf {} \;

FROM debian:bookworm-slim AS run_stage
FROM debian:trixie-slim AS run_stage

# Install required packages
RUN set -x \
&& apt-get update \
&& apt-get install -y --no-install-recommends --no-install-suggests \
ca-certificates=20230311 \
gdb-minimal=13.1-3 \
lib32stdc++6=12.2.0-14 \
&& apt update \
&& apt install -y --no-install-recommends --no-install-suggests \
ca-certificates=20240203 \
gdb-minimal=13.2-1 \
lib32stdc++6=14-20240201-3 \
&& rm -rf /var/lib/apt/lists/*

ARG APPDIR
Expand Down
17 changes: 17 additions & 0 deletions utils/getDepotsByMod.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

case "$1" in
"valve")
echo "1 4 1006"
;;
"cstrike")
echo "1 4 1006 11"
;;
"czero")
echo "1 4 1006 11 81"
;;
*)
echo "Invalid argument \"$1\""
exit 1
;;
esac

0 comments on commit 455f96d

Please sign in to comment.