diff --git a/.vscode/tasks.json b/.vscode/tasks.json index b172a24..68ca57f 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -18,6 +18,33 @@ "kind": "build", "isDefault": false } + }, + { + "label": "Build ReDeathmatch Image", + "type": "docker-build", + "dockerBuild": { + "context": "${workspaceFolder}/", + "tag": "redeathmatch:${input:mod}", + "buildArgs": { + "MOD": "${input:mod}" + } + }, + "group": { + "kind": "build", + "isDefault": false + } + }, + { + "type": "shell", + "label": "Run HLDS container", + "command": "docker run --rm -ti -p 26900-27020:26900-27020/udp redeathmatch:${input:mod} ./hlds_run -game ${input:mod} +maxplayers 32 -bots +ip 0.0.0.0 -port 27016 +map de_dust2", + "dependsOn": [ + "Build ReDeathmatch Image" + ], + "group": { + "kind": "build", + "isDefault": false + } } ], "presentation": { @@ -44,5 +71,17 @@ "severity": 4, "message": 5 } - } + }, + "inputs": [ + { + "type": "pickString", + "id": "mod", + "default": "cstrike", + "description": "Select mod.", + "options": [ + "cstrike", + "czero" + ] + } + ] } \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..bb8b7a8 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,58 @@ +# syntax=docker/dockerfile:1 + +ARG MOD="cstrike" + +FROM debian:trixie-slim AS build_stage + +# Install required packages +RUN set -x \ + && apt-get update \ + && apt-get install -y --no-install-recommends --no-install-suggests \ + ca-certificates=20240203 \ + curl=8.5.0-2 \ + libarchive-tools=3.7.2-1 \ + lib32stdc++6=14-20240201-3 \ + && rm -rf /var/lib/apt/lists/* + +WORKDIR /usr/local/bin/ +ADD --chmod=755 https://raw.githubusercontent.com/hldsdocker/rehlds/master/utils/GetGithubReleaseUrl.sh GetGithubReleaseUrl + +WORKDIR /root/hlds/cstrike + +# Install Metamod-R +RUN releaseLink="https://github.com/theAsmodai/metamod-r/releases/download/1.3.0.149/metamod-bin-1.3.0.149.zip" \ + && curl -sSL ${releaseLink} | bsdtar -xf - --exclude='*.dll' --exclude='*.pdb' addons/* + +# Install AMXModX 1.9.0 +ARG AMXModX_URL="https://www.amxmodx.org/amxxdrop/1.9/amxmodx-1.9.0-git5294-base-linux.tar.gz" +RUN curl -sSL ${AMXModX_URL} | bsdtar -xf - addons/ \ + && echo "linux addons/amxmodx/dlls/amxmodx_mm_i386.so" > addons/metamod/plugins.ini + +# Install ReAPI +RUN releaseLink="https://github.com/s1lentq/reapi/releases/download/5.24.0.300/reapi-bin-5.24.0.300.zip" \ + && curl -sSL ${releaseLink} | bsdtar -xf - --exclude='*.dll' --exclude='*.pdb' addons/ + +COPY cstrike . + +SHELL ["/bin/bash", "-c"] + +WORKDIR /usr/local/bin/ +COPY --chmod=755 .vscode/build.sh BuildAMXXPlugins + +WORKDIR /root/hlds/cstrike/addons/amxmodx/ +RUN BuildAMXXPlugins . . + + +WORKDIR /root/hlds/cstrike/ +ARG YaPB_URL="https://github.com/yapb/yapb/releases/download/4.4.957/yapb-4.4.957-linux.tar.xz" +RUN curl -sSL ${YaPB_URL} | bsdtar -xf - addons/ \ + && echo "linux addons/yapb/bin/yapb.so" >> addons/metamod/plugins.ini + + +ARG MOD +FROM hldsdocker/rehlds-${MOD}:regamedll AS run_stage + +COPY --chown=${APPUSER}:${APPUSER} --chmod=755 --from=build_stage /root/hlds/cstrike ${MOD} + +# Activate Metamod-R +RUN sed -i 's/gamedll_linux ".*"/gamedll_linux "addons\/metamod\/metamod_i386.so"/' ${MOD}/liblist.gam