diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index ed5074e..b1780e7 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -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: @@ -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/checkout@v4.1.1 @@ -36,11 +36,12 @@ jobs: - name: Cache Docker layers uses: actions/cache@v4.0.2 + 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' @@ -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 \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 7e5353f..e936206 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -7,7 +7,8 @@ "dockerBuild": { "context": "${workspaceFolder}", "buildArgs": { - "APPBRANCH": "${input:betaBranch}" + "APPBRANCH": "${input:betaBranch}", + "MOD": "${input:mod}", }, "tag": "hlds_image" }, @@ -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" + ] + }, ] } \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 3fa24b9..eca962f 100755 --- a/Dockerfile +++ b/Dockerfile @@ -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 @@ -13,11 +13,11 @@ LABEL creator="Sergey Shorokhov " # 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 @@ -25,9 +25,11 @@ ARG DepotDownloader_URL="https://github.com/SteamRE/DepotDownloader/releases/dow 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 @@ -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 diff --git a/utils/getDepotsByMod.sh b/utils/getDepotsByMod.sh new file mode 100755 index 0000000..4401f6f --- /dev/null +++ b/utils/getDepotsByMod.sh @@ -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 \ No newline at end of file