diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..0b51ec4 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,46 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "Build HLDS Image", + "type": "docker-build", + "dockerBuild": { + "context": "${workspaceFolder}", + "buildArgs": { + "MOD": "${input:mod}" + }, + "tag": "rehlds_image:${input:mod}" + }, + "group": { + "kind": "build", + "isDefault": true + } + }, + { + "type": "shell", + "label": "Run HLDS container", + "command": "docker run --rm -ti -p 26900-27020:26900-27020/udp rehlds_image:${input:mod}", + "dependsOn": [ + "Build HLDS Image" + ] + } + ], + "inputs": [ + { + "type": "pickString", + "id": "mod", + "default": "valve", + "description": "Select mod.", + "options": [ + "valve", + "cstrike", + "czero", + "dod", + "gearbox", + "tfc", + "ricochet", + "dmc" + ] + } + ] +} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index d1178d4..06d50b1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,9 @@ -ARG APPDIR="/root/hlds" +# syntax=docker/dockerfile:1 -FROM debian:bookworm-slim AS build_stage -ARG APPDIR +ARG MOD="valve" +ARG TAG="steam_legacy" + +FROM debian:trixie-slim AS build_stage LABEL creator="Sergey Shorokhov " @@ -9,21 +11,26 @@ LABEL creator="Sergey Shorokhov " RUN set -x \ && apt-get update \ && apt-get install -y --no-install-recommends --no-install-suggests \ - ca-certificates curl libarchive-tools \ + ca-certificates=20240203 \ + curl=8.5.0-2 \ + libarchive-tools=3.7.2-1 \ && rm -rf /var/lib/apt/lists/* -WORKDIR /root/ -COPY --chmod=755 utils/* utils/ +WORKDIR /usr/local/bin/ + +ADD --chmod=755 https://raw.githubusercontent.com/hldsdocker/rehlds/master/utils/GetGithubReleaseUrl.sh GetGithubReleaseUrl + +WORKDIR /root/hlds # Install ReHLDS -RUN releaseLink=$(utils/GetGithubReleaseUrl.sh "dreamstalker/rehlds" "latest") \ - && mkdir -p $APPDIR \ - && curl -L# $releaseLink | bsdtar -xf - --strip-components=2 --directory $APPDIR bin/linux32/* \ - && chmod +x $APPDIR/hlds_linux $APPDIR/hltv \ - && rm -rf utils +RUN releaseLink=$(GetGithubReleaseUrl "dreamstalker/rehlds" "latest") \ + && curl -sSL $releaseLink | bsdtar -xf - --strip-components=2 bin/linux32/* \ + && chmod +x hlds_linux hltv +# Install ReGameDLL_CS +RUN releaseLink=$(GetGithubReleaseUrl "s1lentq/ReGameDLL_CS" "latest") \ + && curl -sSL $releaseLink | bsdtar -xf - --strip-components=2 bin/linux32/* -FROM wopox1337/hlds:steam_legacy AS run_stage -ARG APPDIR +FROM hldsdocker/${MOD}:${TAG} AS run_stage -COPY --chmod=755 --from=build_stage ${APPDIR} ${APPDIR} +COPY --chown=${APPUSER}:${APPUSER} --chmod=755 --from=build_stage /root/hlds .