From 83f5faa658b893003ce18570998dc224f262345b Mon Sep 17 00:00:00 2001 From: James Ives Date: Mon, 9 Sep 2024 09:46:39 -0400 Subject: [PATCH] =?UTF-8?q?feat:=20=E2=9C=A8=20Adds=20server=20startup=20i?= =?UTF-8?q?nformation=20(#32)=20#minor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * build: add auto-labeler and sponsors information (#17) * Update README.md * Create sponsors.yml * Create label.yml * test: resolve issue thing * style: remove typo * chore: update * build(deps): bump softprops/action-gh-release from 1 to 2 (#18) Bumps [softprops/action-gh-release](https://github.com/softprops/action-gh-release) from 1 to 2. - [Release notes](https://github.com/softprops/action-gh-release/releases) - [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md) - [Commits](https://github.com/softprops/action-gh-release/compare/v1...v2) --- updated-dependencies: - dependency-name: softprops/action-gh-release dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * build(deps): bump actions/checkout from 3 to 4 (#19) Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * docs: 📝 Improve documentation (#21) * docs: docker whale image * Update README.md * Update README.md * Update README.md * docs: add more examples * docs: add more examples * docs: improve docs * Update README.md * Update README.md * Update README.md * test * Update BUILDING_AN_IMAGE.md * Update label.yml * Delete crowbar.png * Update README.md * Update sponsors.yml * docs: more doc improvements/spell checks etc * Deploying to beta from @ JamesIves/hlds-docker@ee94d7ce3c59b132a08827d977fb9df8e620a0b7 🚀 * Update sponsors.yml * Update README.md * docs: server -> joinable not error * Update CUSTOM_MODS.md * Update SERVER_CONFIGS_AND_PLUGINS.md * Update README.md * Update README.md * Update BUG.yml * docs: fix clipping issue * build: :wrench: adjust docker-compose.local to docker-compose.build as it more accurately describes its task * feat: split things into container dir * docs: shuffle docs around * Update beta.yml * Update publish.yml * Update README.md * docs: improve REAMDE * Update README.md * Update CONTRIBUTING.md * docs: remove old examples * docs: cleanup docs * Update Dockerfile * Update Dockerfile * Update Dockerfile * docs: more doc examples. * Update docker-compose.yml * Update .gitignore * Update entrypoint.sh * build(deps): bump anothrNick/github-tag-action from 1.69.0 to 1.70.0 (#24) Bumps [anothrNick/github-tag-action](https://github.com/anothrnick/github-tag-action) from 1.69.0 to 1.70.0. - [Release notes](https://github.com/anothrnick/github-tag-action/releases) - [Commits](https://github.com/anothrnick/github-tag-action/compare/1.69.0...1.70.0) --- updated-dependencies: - dependency-name: anothrNick/github-tag-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * docs: 📝 Improved bug report form and added rcon_password example (#26) * Update BUG.yml * t * Update BUG.yml * Update BUG.yml * docs: include private sponsors [skip ci] * chore: Update sponsors 💖 [skip ci] * docs: update sponsors again [skip ci] * chore: Update sponsors 💖 [skip ci] * Update sponsors.yml * chore: Update sponsors 💖 [skip ci] * chore: Update sponsors 💖 [skip ci] * feat: support titles with legacy beta versions, ie valve-legacy, cstrike-legacy and czero-legacy * fix: properly pass in flags * fix: adjust how flags are passed in * build: :wrench: Rename FLAGS -> FLAG to mirror GAME * fix: pass in correct game name * docs: remove build: docker as its not needed * build(startup): :wrench: Setup initial build debug scripts * build: add meta data for image * fix: adjust ordering of ascii art * chore: adjust default startup to use hldm --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: JamesIves --- .github/workflows/beta.yml | 8 +++++++ .github/workflows/publish.yml | 9 ++++++- README.md | 4 ++-- container/Dockerfile | 31 ++++++++++++++++-------- container/docker-compose.yml | 6 ++++- container/entrypoint.sh | 44 +++++++++++++++++++++++++++++++++-- docker-compose.yml | 4 ++-- 7 files changed, 88 insertions(+), 18 deletions(-) diff --git a/.github/workflows/beta.yml b/.github/workflows/beta.yml index 66f6e84..429ec74 100644 --- a/.github/workflows/beta.yml +++ b/.github/workflows/beta.yml @@ -71,6 +71,8 @@ jobs: env: GAME: ${{ env.GAME }} FLAG: ${{ env.FLAG }} + VERSION: beta + IMAGE: jives/hlds:${{ matrix.game }}-beta with: context: ./container push: true @@ -78,6 +80,8 @@ jobs: build-args: | GAME=${{ env.GAME }} FLAG=${{ env.FLAG }} + IMAGE=jives/hlds:${{ matrix.game }}-beta + VERSION=beta - name: Set repo owner to lowercase id: repo_owner @@ -88,6 +92,8 @@ jobs: env: GAME: ${{ env.GAME }} FLAG: ${{ env.FLAG }} + VERSION: beta + IMAGE: ghcr.io/${{ steps.repo_owner.outputs.repo_owner }}/hlds:${{ matrix.game }}-beta with: context: ./container push: true @@ -95,3 +101,5 @@ jobs: build-args: | GAME=${{ env.GAME }} FLAG=${{ env.FLAG }} + VERSION=beta + IMAGE=ghcr.io/${{ steps.repo_owner.outputs.repo_owner }}/hlds:${{ matrix.game }}-beta diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index b06a282..4de2bad 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -20,7 +20,6 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} WITH_V: true - DEFAULT_BUMP: patch DRY_RUN: true build: @@ -91,6 +90,8 @@ jobs: env: GAME: ${{ env.GAME }} FLAG: ${{ env.FLAG }} + VERSION: ${{ needs.version.outputs.version }} + IMAGE: jives/hlds:${{ matrix.game }}-${{ needs.version.outputs.version }} with: context: ./container push: true @@ -100,6 +101,8 @@ jobs: build-args: | GAME=${{ env.GAME}} FLAG=${{ env.FLAG }} + VERSION=${{ needs.version.outputs.version }} + IMAGE: jives/hlds:${{ matrix.game }}-${{ needs.version.outputs.version }} - name: Set repo owner to lowercase id: repo_owner @@ -110,6 +113,8 @@ jobs: env: GAME: ${{ matrix.game }} FLAG: ${{ env.FLAG }} + VERSION: ${{ needs.version.outputs.version }} + IMAGE: ghcr.io/${{ steps.repo_owner.outputs.repo_owner }}/hlds:${{ matrix.game }}-${{ needs.version.outputs.version }} with: context: ./container push: true @@ -119,6 +124,8 @@ jobs: build-args: | GAME=${{ env.GAME }} FLAG=${{ env.FLAG }} + VERSION=${{ needs.version.outputs.version }} + IMAGE: ghcr.io/${{ steps.repo_owner.outputs.repo_owner }}/hlds:${{ matrix.game }}-${{ needs.version.outputs.version }} publish: needs: build diff --git a/README.md b/README.md index dab71e2..b25d960 100644 --- a/README.md +++ b/README.md @@ -26,8 +26,8 @@ docker run -d \ -p 27015:27015 \ -p 26900:26900/udp \ -e GAME=${GAME} \ - jives/hlds:cstrike \ - "+log on +rcon_password changeme +maxplayers 12 +map cs_italy" # 📣 Modify your server startup commands here. You can specify the image with the desired game you want the server to run in the line above. + jives/hlds:valve \ + "+log on +rcon_password changeme +maxplayers 12 +map crossfire" # 📣 Modify your server startup commands here. You can specify the image with the desired game you want the server to run in the line above. ``` > [!TIP] diff --git a/container/Dockerfile b/container/Dockerfile index b3ab569..3cc9d6f 100644 --- a/container/Dockerfile +++ b/container/Dockerfile @@ -1,14 +1,5 @@ FROM ubuntu:18.04 -LABEL org.opencontainers.image.title="hlds" -LABEL org.opencontainers.image.description="🐋 📦 Half-Life Dedicated Server powered by Docker. Supports all the classic GoldSrc Half-Life games and mods, including the ability to add custom configurations and plugins." -LABEL org.opencontainers.image.vendor="https://jamesiv.es" -LABEL org.opencontainers.image.authors="James Ives" -LABEL org.opencontainers.image.licenses="MIT" -LABEL org.opencontainers.image.url="https://github.com/jamesives/hlds-docker" -LABEL org.opencontainers.image.documentation="https://github.com/jamesives/hlds-docker" -LABEL org.opencontainers.image.source="https://github.com/jamesives/hlds-docker" - # Sets an environment variable for the game to install. # Supported games: valve, cstrike, czero, dod, dmc, gearbox, ricochet, tfc # Default is valve. This get replaced when building the image with --build-arg GAME= @@ -21,6 +12,25 @@ ENV GAME ${GAME} ARG FLAG ENV FLAG ${FLAG} +# Sets an environment variable for the version of the image. +ARG VERSION=custom +ENV VERSION ${VERSION} + +# Sets an environment variable for the image name. +ARG IMAGE=custom +ENV IMAGE ${IMAGE} + +# Tags the image with the Open Containers Initiative (OCI) image format. +LABEL org.opencontainers.image.title="hlds:${GAME}" +LABEL org.opencontainers.image.description="🐋 📦 Half-Life Dedicated Server powered by Docker. Supports all the classic GoldSrc Half-Life games and mods, including the ability to add custom configurations and plugins." +LABEL org.opencontainers.image.vendor="https://jamesiv.es" +LABEL org.opencontainers.image.authors="James Ives (https://jamesiv.es)" +LABEL org.opencontainers.image.licenses="MIT" +LABEL org.opencontainers.image.url="https://github.com/jamesives/hlds-docker" +LABEL org.opencontainers.image.documentation="https://github.com/jamesives/hlds-docker" +LABEL org.opencontainers.image.source="https://github.com/jamesives/hlds-docker" +LABEL org.opencontainers.image.version="${VERSION}" + RUN dpkg --add-architecture i386 && \ apt-get update && \ apt-get install -y --no-install-recommends curl rsync file libc6:i386 lib32stdc++6 ca-certificates && \ @@ -60,4 +70,5 @@ COPY --chown=steam:steam mods . RUN chmod +x ./entrypoint.sh -ENTRYPOINT ["./entrypoint.sh"] \ No newline at end of file + +ENTRYPOINT ["./entrypoint.sh"] diff --git a/container/docker-compose.yml b/container/docker-compose.yml index 9049202..8c0364e 100644 --- a/container/docker-compose.yml +++ b/container/docker-compose.yml @@ -5,6 +5,8 @@ services: args: - GAME=${GAME} - FLAG=${FLAG} + - VERSION=${VERSION} + - IMAGE=${IMAGE} volumes: - "./config:/temp/config" - "./mods:/temp/mods" @@ -15,4 +17,6 @@ services: environment: - GAME=${GAME} - FLAG=${FLAG} - command: +maxplayers 12 +log on + - VERSION=${VERSION} + - IMAGE=${IMAGE} + command: +maxplayers 12 +log on +rcon_password "changeme" +map crossfire diff --git a/container/entrypoint.sh b/container/entrypoint.sh index 0b76d03..318730c 100644 --- a/container/entrypoint.sh +++ b/container/entrypoint.sh @@ -1,7 +1,8 @@ #!/usr/bin/env sh -# Set GAME to its value if defined, or 'valve' if not GAME=${GAME:-valve} +VERSION=${VERSION:-custom} +IMAGE=${IMAGE:-custom} if echo "$@" | grep -qv "+map"; then echo -e "\e[33mWarning: No +map specified in the command. Server will start but may not be joinable.\e[0m" @@ -18,7 +19,46 @@ then rsync --chown=steam:steam /temp/config/* /opt/steam/hlds/$GAME fi -echo -e "\e[32mStarting Half-Life Dedicated Server for $GAME...\e[0m" + +echo " + ..::::::.. + :-=++++++++++++=-: + :=++++=--::...::-=++++=: + :=+++=: :-++++: + =+++- =====: -+++= + ++++. ===+++. .=+++ + =+++ :+++ =+++ + :+++. -+++= .+++: + =++= =+++++- =++= + =++- .=++-:+++: -+++ + =++= .+++- -+++. =++= + :+++. :+++. =+++ .+++: + =+++ =++=. ++++++= =++= + =+++. -==- .+++=-: .=+++ + =+++-. -+++= + :=+++=: :=+++=: + :=+++++=-::..::-=+++++=: + :-=++++++++++++=-: + ..::::::.. + + hlds-docker + +==================================================================== +💿 Image: $IMAGE +📎 Version: $VERSION +🎮 Game: $GAME +==================================================================== + +▄▄ LINKS ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ +█ █ +█ 🔧 Maintained by Jives: https://jives.dev █ +█ 💖 Support: https://github.com/sponsors/JamesIves █ +█ 🔔 Feedback / Issues: https://github.com/JamesIves/hlds-docker █ +█ █ +▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ +" + +echo "\e[32mStarting Half-Life Dedicated Server...\e[0m" # Start the server with the specified game and any additional arguments. ./hlds_run "-game $GAME $@" diff --git a/docker-compose.yml b/docker-compose.yml index 4e5e874..b8b1bdb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,7 +12,7 @@ services: # 🔧 jives/hlds:valve-legacy (Half-Life Deathmatch) (Pre 25th Anniversary Edition) # 🔧 jives/hlds:cstrike-legacy (Counter-Strike) (Pre 25th Anniversary Edition) # 🔧 jives/hlds:czero-legacy (Counter-Strike: Condition Zero) (Pre 25th Anniversary Edition) - image: jives/hlds:cstrike + image: jives/hlds:valve # 📣 Learn more about these volumes in the advanced setup guides: https://github.com/JamesIves/hlds-docker?tab=readme-ov-file#advanced-setup-%EF%B8%8F volumes: - "./config:/temp/config" @@ -26,4 +26,4 @@ services: # 📣 Modify your server startup commands here, you can add more FLAG as needed (see: https://developer.valvesoftware.com/wiki/Half-Life_Dedicated_Server), # 📣 Remember: Stating map is based on the game, and will likely be different between images. # 📣 You should also modify the rcon_password value so you can use server admin commands. - command: +log on +rcon_password "changeme" +maxplayers 12 +map cs_italy + command: +log on +rcon_password "changeme" +maxplayers 12 +map crossfire