├── .github ├── FUNDING.yml ├── dependabot.yml └── workflows │ ├── action-update-copyright-years-in-license-file.yml │ ├── action-dockerhub-description.yml │ ├── action-prettier.yml │ ├── action-super-linter.yml │ └── action-docker-publish.yml ├── .hadolint.yml ├── .vscode ├── settings.json └── extensions.json ├── entrypoint-healthcheck.sh ├── .prettierrc.json ├── .checkov.yml ├── .yamllint.yml ├── .gitignore ├── .dockerignore ├── .editorconfig ├── docker-compose.yml ├── LICENSE.md ├── .devcontainer └── devcontainer.json ├── README.md ├── package.json ├── entrypoint.sh ├── entrypoint-user.sh ├── Dockerfile.ubuntu-2004 ├── Dockerfile.ubuntu-2204 └── Dockerfile.ubuntu-2404 /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: dgibbs64 2 | patreon: dgibbs 3 | -------------------------------------------------------------------------------- /.hadolint.yml: -------------------------------------------------------------------------------- 1 | ignored: 2 | - DL3008 # Pin versions in apt-get install 3 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "ansible.python.interpreterPath": "/bin/python3" 3 | } 4 | -------------------------------------------------------------------------------- /entrypoint-healthcheck.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | exec gosu "${USER}" /app/*server monitor || exit 1 3 | -------------------------------------------------------------------------------- /.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "plugins": ["prettier-plugin-sh", "prettier-plugin-jinja-template"] 3 | } 4 | -------------------------------------------------------------------------------- /.checkov.yml: -------------------------------------------------------------------------------- 1 | skip-check: 2 | - CKV_DOCKER_2 3 | - CKV_DOCKER_3 4 | - CKV_DOCKER_8 5 | - CKV2_DOCKER_1 6 | skip-path: 7 | - node_modules/ 8 | -------------------------------------------------------------------------------- /.yamllint.yml: -------------------------------------------------------------------------------- 1 | --- 2 | extends: default 3 | 4 | rules: 5 | line-length: disable 6 | comments: disable 7 | 8 | ignore: | 9 | .github 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Visual Studio Code 2 | .vscode/* 3 | !.vscode/tasks.json 4 | !.vscode/launch.json 5 | !.vscode/extensions.json 6 | !.vscode/*.code-snippets 7 | .history/ 8 | *.vsix 9 | 10 | # Node.js 11 | node_modules 12 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "github-actions" 4 | directory: "/" 5 | schedule: 6 | interval: "weekly" 7 | 8 | - package-ecosystem: "devcontainers" 9 | directory: "/" 10 | schedule: 11 | interval: weekly 12 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "DavidAnson.vscode-markdownlint", 4 | "editorconfig.editorconfig", 5 | "esbenp.prettier-vscode", 6 | "exiasr.hadolint", 7 | "github.vscode-github-actions", 8 | "GitHub.vscode-pull-request-github", 9 | "ms-azuretools.vscode-containers", 10 | "redhat.vscode-yaml", 11 | "yzhang.markdown-all-in-one" 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | **/.classpath 2 | **/.dockerignore 3 | **/.env 4 | **/.git 5 | **/.gitignore 6 | **/.project 7 | **/.settings 8 | **/.toolstarget 9 | **/.vs 10 | **/.vscode 11 | **/*.*proj.user 12 | **/*.dbmdl 13 | **/*.jfm 14 | **/bin 15 | **/charts 16 | **/docker-compose* 17 | **/compose* 18 | **/Dockerfile* 19 | **/node_modules 20 | **/npm-debug.log 21 | **/obj 22 | **/secrets.dev.yaml 23 | **/values.dev.yaml 24 | README.md 25 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig helps developers define and maintain consistent coding styles between different editors and IDEs. 2 | # http://editorconfig.org/ 3 | 4 | root = true 5 | 6 | [*] 7 | charset = utf-8 8 | end_of_line = lf 9 | indent_size = 2 10 | indent_style = space 11 | insert_final_newline = true 12 | trim_trailing_whitespace = true 13 | 14 | # BASH Files 15 | [*.{.sh}] 16 | indent_size = 4 17 | indent_style = tab 18 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3.4" 2 | services: 3 | linuxgsm: 4 | build: 5 | context: . 6 | dockerfile: ./Dockerfile.ubuntu-2204 7 | container_name: jc2server 8 | environment: 9 | - GAMESERVER=jc2server 10 | - LGSM_GITHUBUSER=GameServerManagers 11 | - LGSM_GITHUBREPO=LinuxGSM 12 | - LGSM_GITHUBBRANCH=develop 13 | volumes: 14 | - /home/linuxgsm/jc2server/serverfiles:/linuxgsm/serverfiles 15 | - /home/linuxgsm/jc2server/log:/linuxgsm/log 16 | - /home/linuxgsm/jc2server/config-lgsm:/linuxgsm/config-lgsm 17 | ports: 18 | - "25565:25565/tcp" 19 | - "25575:25575/udp" 20 | restart: unless-stopped 21 | -------------------------------------------------------------------------------- /.github/workflows/action-update-copyright-years-in-license-file.yml: -------------------------------------------------------------------------------- 1 | name: Update copyright year(s) in license file 2 | 3 | on: 4 | workflow_dispatch: 5 | schedule: 6 | - cron: "0 3 1 1 *" # 03:00 AM on January 1 7 | 8 | permissions: 9 | contents: write 10 | 11 | jobs: 12 | update-license-year: 13 | runs-on: ubuntu-latest 14 | steps: 15 | - name: Checkout 16 | uses: actions/checkout@v5 17 | with: 18 | fetch-depth: 0 19 | persist-credentials: false 20 | - name: Action Update License Year 21 | uses: FantasticFiasco/action-update-license-year@v3 22 | with: 23 | token: ${{ secrets.GITHUB_TOKEN }} 24 | path: LICENSE.md 25 | - name: Merge pull request 26 | env: 27 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 28 | run: | 29 | gh pr merge --merge --delete-branch 30 | -------------------------------------------------------------------------------- /.github/workflows/action-dockerhub-description.yml: -------------------------------------------------------------------------------- 1 | name: Update Docker Hub Description 2 | 3 | on: 4 | workflow_dispatch: 5 | push: 6 | paths: 7 | - README.md 8 | - .github/workflows/dockerhub-description.yml 9 | branches: 10 | - main 11 | 12 | permissions: 13 | contents: read 14 | 15 | jobs: 16 | dockerhub-description: 17 | name: Docker Hub Description 18 | runs-on: ubuntu-latest 19 | steps: 20 | - name: Checkout 21 | uses: actions/checkout@v5 22 | with: 23 | persist-credentials: false 24 | 25 | - name: Docker Hub Description 26 | uses: peter-evans/dockerhub-description@v5 27 | with: 28 | username: ${{ secrets.DOCKER_HUB_USERNAME }} 29 | password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} 30 | repository: ${{ secrets.DOCKER_HUB_REPO }} 31 | short-description: ${{ github.event.repository.description }} 32 | -------------------------------------------------------------------------------- /.github/workflows/action-prettier.yml: -------------------------------------------------------------------------------- 1 | name: Prettier 2 | 3 | on: 4 | workflow_dispatch: 5 | push: 6 | branches: 7 | - "*" 8 | 9 | concurrency: 10 | group: prettier-${{ github.ref }} 11 | cancel-in-progress: true 12 | 13 | permissions: 14 | contents: write 15 | 16 | jobs: 17 | prettier: 18 | runs-on: ubuntu-latest 19 | 20 | steps: 21 | - name: Checkout 22 | uses: actions/checkout@v5 23 | with: 24 | persist-credentials: false 25 | 26 | - name: Install Prettier and plugins 27 | run: | 28 | npm install --no-save prettier prettier-plugin-sh prettier-plugin-jinja-template 29 | 30 | - name: Prettify code 31 | uses: creyD/prettier_action@v4.6 32 | with: 33 | prettier_plugins: "prettier-plugin-sh prettier-plugin-jinja-template" 34 | prettier_options: --write . 35 | github_token: ${{ secrets.GITHUB_TOKEN }} 36 | commit_message: "chore(prettier): format code" 37 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | # The MIT License (MIT) 2 | 3 | Copyright (c) 2025 Daniel Gibbs 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Docker Dev Container", 3 | "image": "mcr.microsoft.com/devcontainers/base:ubuntu", 4 | "features": { 5 | "ghcr.io/devcontainers-community/npm-features/prettier:1": { 6 | "plugins": "prettier-plugin-sh prettier-plugin-jinja-template" 7 | }, 8 | "ghcr.io/devcontainers-extra/features/actionlint:1": {}, 9 | "ghcr.io/devcontainers-extra/features/checkov:1": {}, 10 | "ghcr.io/devcontainers-extra/features/markdownlint-cli:1": {}, 11 | "ghcr.io/devcontainers-extra/features/shellcheck:1": {}, 12 | "ghcr.io/devcontainers-extra/features/yamllint:2": {}, 13 | "ghcr.io/devcontainers/features/docker-outside-of-docker:1": {}, 14 | "ghcr.io/devcontainers/features/github-cli:1": {}, 15 | "ghcr.io/dhoeric/features/hadolint:1": {} 16 | }, 17 | "customizations": { 18 | "vscode": { 19 | "extensions": [ 20 | "DavidAnson.vscode-markdownlint", 21 | "editorconfig.editorconfig", 22 | "esbenp.prettier-vscode", 23 | "exiasr.hadolint", 24 | "github.vscode-github-actions", 25 | "GitHub.vscode-pull-request-github", 26 | "ms-azuretools.vscode-containers", 27 | "redhat.vscode-yaml", 28 | "yzhang.markdown-all-in-one" 29 | ] 30 | } 31 | }, 32 | "postCreateCommand": "npm init -y >/dev/null 2>&1 || true && npm install --no-save prettier prettier-plugin-sh prettier-plugin-jinja-template" 33 | } 34 | -------------------------------------------------------------------------------- /.github/workflows/action-super-linter.yml: -------------------------------------------------------------------------------- 1 | name: Super Linter 2 | 3 | on: 4 | workflow_dispatch: 5 | push: 6 | branches: 7 | - "*" 8 | 9 | concurrency: 10 | group: super-linter-${{ github.ref }} 11 | cancel-in-progress: true 12 | 13 | permissions: {} 14 | 15 | jobs: 16 | build: 17 | name: Lint 18 | runs-on: ubuntu-latest 19 | 20 | permissions: 21 | contents: read 22 | packages: read 23 | # To report GitHub Actions status checks 24 | statuses: write 25 | 26 | steps: 27 | - name: Checkout code 28 | uses: actions/checkout@v5 29 | with: 30 | # super-linter needs the full git history to get the 31 | # list of files that changed across commits 32 | fetch-depth: 0 33 | persist-credentials: false 34 | 35 | - name: Install Prettier plugins (for summary formatting) 36 | run: | 37 | npm install --no-save prettier prettier-plugin-sh prettier-plugin-jinja-template || true 38 | 39 | - name: Super-linter 40 | uses: super-linter/super-linter@v8 41 | env: 42 | # To report GitHub Actions status checks 43 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 44 | VALIDATE_BIOME_FORMAT: false 45 | VALIDATE_BIOME_LINT: false 46 | VALIDATE_GITHUB_ACTIONS_ZIZMOR: false 47 | VALIDATE_JSCPD: false 48 | VALIDATE_JSON_PRETTIER: false 49 | VALIDATE_MARKDOWN_PRETTIER: false 50 | VALIDATE_NATURAL_LANGUAGE: false 51 | VALIDATE_SHELL_SHFMT: false 52 | VALIDATE_TERRAFORM_TERRASCAN: false 53 | VALIDATE_TRIVY: false 54 | VALIDATE_YAML_PRETTIER: false 55 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LinuxGSM Base Docker Image 2 | 3 | ## This is the base LinuxGSM image only 4 | 5 | ## Use docker-gameserver for full game servers 6 | 7 |

8 | LinuxGSM 9 |
10 | Docker Pulls 11 | GitHub Workflow Status 12 | Codacy grade 13 | SteamCMD 14 | MIT License

15 | 16 | ## About 17 | 18 | LinuxGSM is a command-line tool for quick, simple deployment and management of Linux dedicated game servers. This container image builds weekly and is available on [Docker Hub](https://hub.docker.com/r/gameservermanagers/linuxgsm) as well as [GitHub Container Registry](https://github.com/GameServerManagers/docker-linuxgsm/pkgs/container/linuxgsm). 19 | 20 | ## Tags 21 | 22 | - `latest`, `ubuntu` - Latest Ubuntu LTS release 23 | - `ubuntu-24.04` - Ubuntu 24.04 LTS 'Noble Numbat' 24 | - `ubuntu-22.04` - Ubuntu 22.04 LTS 'Jammy Jackalope' 25 | - `ubuntu-20.04` - Ubuntu 20.04 LTS 'Focal Fossa' 26 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "docker-linuxgsm", 3 | "version": "1.0.0", 4 | "description": "

\"LinuxGSM\"
\"Docker \"GitHub \"Codacy \"SteamCMD\" \"MIT

", 5 | "main": "index.js", 6 | "dependencies": { 7 | "prettier": "^3.6.2", 8 | "prettier-plugin-jinja-template": "^2.1.0", 9 | "prettier-plugin-sh": "^0.18.0", 10 | "sh-syntax": "^0.5.8", 11 | "tslib": "^2.8.1" 12 | }, 13 | "devDependencies": {}, 14 | "scripts": { 15 | "test": "echo \"Error: no test specified\" && exit 1" 16 | }, 17 | "repository": { 18 | "type": "git", 19 | "url": "git+https://github.com/GameServerManagers/docker-linuxgsm.git" 20 | }, 21 | "keywords": [], 22 | "author": "", 23 | "license": "ISC", 24 | "bugs": { 25 | "url": "https://github.com/GameServerManagers/docker-linuxgsm/issues" 26 | }, 27 | "homepage": "https://github.com/GameServerManagers/docker-linuxgsm#readme" 28 | } 29 | -------------------------------------------------------------------------------- /entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | exit_handler() { 4 | # Execute the shutdown commands 5 | echo -e "Stopping ${GAMESERVER}" 6 | exec gosu "${USER}" ./"${GAMESERVER}" stop 7 | exitcode=$? 8 | exit ${exitcode} 9 | } 10 | 11 | # Exit trap 12 | echo -e "Loading exit handler" 13 | trap exit_handler SIGQUIT SIGINT SIGTERM 14 | 15 | DISTRO="$(grep "PRETTY_NAME" /etc/os-release | awk -F = '{gsub(/"/,"",$2);print $2}')" 16 | echo -e "" 17 | echo -e "Welcome to the LinuxGSM" 18 | echo -e "================================================================================" 19 | echo -e "CURRENT TIME: $(date)" 20 | echo -e "BUILD TIME: $(cat /build-time.txt)" 21 | echo -e "GAMESERVER: ${GAMESERVER}" 22 | echo -e "DISTRO: ${DISTRO}" 23 | echo -e "" 24 | echo -e "USER: ${USER}" 25 | echo -e "UID: ${UID}" 26 | echo -e "GID: ${GID}" 27 | echo -e "" 28 | echo -e "LGSM_GITHUBUSER: ${LGSM_GITHUBUSER}" 29 | echo -e "LGSM_GITHUBREPO: ${LGSM_GITHUBREPO}" 30 | echo -e "LGSM_GITHUBBRANCH: ${LGSM_GITHUBBRANCH}" 31 | echo -e "LGSM_LOGDIR: ${LGSM_LOGDIR}" 32 | echo -e "LGSM_SERVERFILES: ${LGSM_SERVERFILES}" 33 | echo -e "LGSM_DATADIR: ${LGSM_DATADIR}" 34 | echo -e "LGSM_CONFIG: ${LGSM_CONFIG}" 35 | 36 | echo -e "" 37 | echo -e "Initalising" 38 | echo -e "================================================================================" 39 | 40 | export LGSM_GITHUBUSER=${LGSM_GITHUBUSER} 41 | export LGSM_GITHUBREPO=${LGSM_GITHUBREPO} 42 | export LGSM_GITHUBBRANCH=${LGSM_GITHUBBRANCH} 43 | export LGSM_LOGDIR=${LGSM_LOGDIR} 44 | export LGSM_SERVERFILES=${LGSM_SERVERFILES} 45 | export LGSM_DATADIR=${LGSM_DATADIR} 46 | export LGSM_CONFIG=${LGSM_CONFIG} 47 | 48 | cd /app || exit 49 | 50 | # start cron 51 | cron 52 | 53 | echo -e "" 54 | echo -e "Check Permissions" 55 | echo -e "=================================" 56 | echo -e "setting UID to ${UID}" 57 | usermod -u "${UID}" -m -d /data linuxgsm > /dev/null 2>&1 58 | echo -e "setting GID to ${GID}" 59 | groupmod -g "${GID}" linuxgsm 60 | echo -e "updating permissions for /data" 61 | chown -R "${USER}":"${USER}" /data 62 | echo -e "updating permissions for /app" 63 | chown -R "${USER}":"${USER}" /app 64 | export HOME=/data 65 | 66 | echo -e "" 67 | echo -e "Switch to user ${USER}" 68 | echo -e "=================================" 69 | exec gosu "${USER}" /app/entrypoint-user.sh & 70 | wait 71 | -------------------------------------------------------------------------------- /entrypoint-user.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | exit_handler_user() { 4 | # Execute the shutdown commands 5 | echo -e "Stopping ${GAMESERVER}" 6 | ./"${GAMESERVER}" stop 7 | exitcode=$? 8 | exit ${exitcode} 9 | } 10 | 11 | # Exit trap 12 | echo -e "Loading exit handler" 13 | trap exit_handler_user SIGQUIT SIGINT SIGTERM 14 | 15 | # Setup game server 16 | if [ ! -f "${GAMESERVER}" ]; then 17 | echo -e "" 18 | echo -e "creating ${GAMESERVER}" 19 | echo -e "=================================" 20 | ./linuxgsm.sh "${GAMESERVER}" 21 | fi 22 | 23 | # Symlink LGSM_CONFIG to /app/lgsm/config-lgsm 24 | if [ ! -d "/app/lgsm/config-lgsm" ]; then 25 | echo -e "" 26 | echo -e "creating symlink for ${LGSM_CONFIG}" 27 | echo -e "=================================" 28 | ln -s "${LGSM_CONFIG}" "/app/lgsm/config-lgsm" 29 | fi 30 | 31 | # Symlink LGSM_SERVERCFG to /app/serverfiles 32 | if [ ! -d "/app/serverfiles" ]; then 33 | echo -e "" 34 | echo -e "creating symlink for ${LGSM_SERVERCFG}" 35 | echo -e "=================================" 36 | ln -s "${LGSM_SERVERFILES}" "/app/serverfiles" 37 | fi 38 | 39 | # Symlink LGSM_LOGDIR to /app/log 40 | if [ ! -d "/app/log" ]; then 41 | echo -e "" 42 | echo -e "creating symlink for ${LGSM_LOGDIR}" 43 | echo -e "=================================" 44 | ln -s "${LGSM_LOGDIR}" "/app/log" 45 | fi 46 | 47 | # Symlink LGSM_DATADIR to /app/lgsm/data 48 | if [ ! -d "/app/lgsm/data" ]; then 49 | echo -e "" 50 | echo -e "creating symlink for ${LGSM_DATADIR}" 51 | echo -e "=================================" 52 | ln -s "${LGSM_DATADIR}" "/app/lgsm/data" 53 | fi 54 | 55 | # npm install in /app/lgsm 56 | if [ -f "/app/lgsm/package.json" ]; then 57 | echo -e "" 58 | echo -e "npm install in /app/lgsm" 59 | echo -e "=================================" 60 | cd /app/lgsm || exit 61 | npm install 62 | cd /app || exit 63 | fi 64 | 65 | # Clear modules directory if not master 66 | if [ "${LGSM_GITHUBBRANCH}" != "master" ]; then 67 | echo -e "not master branch, clearing modules directory" 68 | rm -rf /app/lgsm/modules/* 69 | ./"${GAMESERVER}" update-lgsm 70 | elif [ -d "/app/lgsm/modules" ]; then 71 | echo -e "ensure all modules are executable" 72 | chmod +x /app/lgsm/modules/* 73 | fi 74 | 75 | # Enable developer mode 76 | if [ "${LGSM_DEV}" == "true" ]; then 77 | echo -e "developer mode enabled" 78 | ./"${GAMESERVER}" developer 79 | fi 80 | 81 | # Install game server 82 | if [ -z "$(ls -A -- "/data/serverfiles" 2> /dev/null)" ]; then 83 | echo -e "" 84 | echo -e "Installing ${GAMESERVER}" 85 | echo -e "=================================" 86 | ./"${GAMESERVER}" auto-install 87 | install=1 88 | else 89 | echo -e "" 90 | # Sponsor to display LinuxGSM logo 91 | ./"${GAMESERVER}" sponsor 92 | fi 93 | 94 | if [ -n "${UPDATE_CHECK}" ] && [ "${UPDATE_CHECK}" != "0" ]; then 95 | echo -e "" 96 | echo -e "Starting Update Checks" 97 | echo -e "=================================" 98 | echo -e "*/${UPDATE_CHECK} * * * * /app/${GAMESERVER} update > /dev/null 2>&1" | crontab - 99 | echo -e "update will check every ${UPDATE_CHECK} minutes" 100 | else 101 | echo -e "" 102 | echo -e "Update checks are disabled" 103 | echo -e "=================================" 104 | fi 105 | 106 | # Update or validate game server 107 | if [ -z "${install}" ]; then 108 | echo -e "" 109 | if [ "${VALIDATE_ON_START,,}" = "true" ]; then 110 | echo -e "Validating ${GAMESERVER}" 111 | echo -e "=================================" 112 | ./"${GAMESERVER}" validate 113 | else 114 | echo -e "Checking for Update ${GAMESERVER}" 115 | echo -e "=================================" 116 | ./"${GAMESERVER}" update 117 | fi 118 | fi 119 | 120 | echo -e "" 121 | echo -e "Starting ${GAMESERVER}" 122 | echo -e "=================================" 123 | ./"${GAMESERVER}" start 124 | sleep 5 125 | ./"${GAMESERVER}" details 126 | sleep 2 127 | echo -e "Tail log files" 128 | echo -e "=================================" 129 | tail -F "${LGSM_LOGDIR}"/{console,script}/*{console,script}.log & 130 | wait 131 | -------------------------------------------------------------------------------- /Dockerfile.ubuntu-2004: -------------------------------------------------------------------------------- 1 | # 2 | # LinuxGSM Base Dockerfile 3 | # 4 | # https://github.com/GameServerManagers/docker-linuxgsm 5 | # 6 | 7 | FROM ghcr.io/gameservermanagers/steamcmd:ubuntu-20.04 8 | 9 | USER root 10 | 11 | ## Remove steam user from upstream base image if present 12 | RUN if id -u steam >/dev/null 2>&1; then echo "Removing steam user from base image"; userdel -r steam || true; else echo "steam user not present"; fi 13 | 14 | LABEL maintainer="LinuxGSM " 15 | ENV DEBIAN_FRONTEND=noninteractive 16 | ENV TERM=xterm 17 | ENV LGSM_GITHUBUSER=GameServerManagers 18 | ENV LGSM_GITHUBREPO=LinuxGSM 19 | ENV LGSM_GITHUBBRANCH=master 20 | ENV LGSM_LOGDIR=/data/log 21 | ENV LGSM_SERVERFILES=/data/serverfiles 22 | ENV LGSM_DATADIR=/data/data 23 | ENV LGSM_CONFIG=/data/config-lgsm 24 | ENV LGSM_COMPRESSEDMAPSDIR=/data/Maps-Compressed 25 | ENV LGSM_DEV=false 26 | ENV GAMESERVER=jc2server 27 | ENV VALIDATE_ON_START=false 28 | ENV UPDATE_CHECK=60 29 | ENV USER=linuxgsm 30 | ENV UID=1000 31 | ENV GID=1000 32 | 33 | SHELL ["/bin/bash", "-o", "pipefail", "-c"] 34 | 35 | ## Install Base LinuxGSM Requirements 36 | RUN echo "**** Install Base LinuxGSM Requirements ****" \ 37 | && apt-get update \ 38 | && apt-get install -y software-properties-common \ 39 | && add-apt-repository multiverse \ 40 | && add-apt-repository ppa:git-core/ppa \ 41 | && apt-get update \ 42 | && apt-get install -y \ 43 | bc \ 44 | binutils \ 45 | bsdmainutils \ 46 | bzip2 \ 47 | ca-certificates \ 48 | cpio \ 49 | cron \ 50 | curl \ 51 | distro-info \ 52 | file \ 53 | git \ 54 | gnupg \ 55 | gosu \ 56 | gzip \ 57 | hostname \ 58 | jq \ 59 | lib32gcc-s1 \ 60 | lib32stdc++6 \ 61 | netcat \ 62 | pigz \ 63 | python3 \ 64 | sudo \ 65 | tar \ 66 | tmux \ 67 | unzip \ 68 | util-linux \ 69 | uuid-runtime \ 70 | wget \ 71 | xz-utils \ 72 | zstd \ 73 | # Docker Extras 74 | iproute2 \ 75 | iputils-ping \ 76 | nano \ 77 | vim \ 78 | && apt-get -y autoremove \ 79 | && apt-get -y clean \ 80 | && rm -rf /var/lib/apt/lists/* \ 81 | && rm -rf /tmp/* \ 82 | && rm -rf /var/tmp/* 83 | 84 | # Install Node.js 85 | RUN echo "**** Install Node.js ****" \ 86 | && set -uex \ 87 | && mkdir -p /etc/apt/keyrings \ 88 | && curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \ 89 | && NODE_MAJOR=20 \ 90 | && echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" > /etc/apt/sources.list.d/nodesource.list \ 91 | && apt-get update \ 92 | && apt-get install nodejs -y \ 93 | && apt-get -y autoremove \ 94 | && apt-get -y clean \ 95 | && rm -rf /var/lib/apt/lists/* \ 96 | && rm -rf /tmp/* \ 97 | && rm -rf /var/tmp/* \ 98 | && npm install -g npm@latest 99 | 100 | # Install GameDig https://docs.linuxgsm.com/requirements/gamedig 101 | RUN echo "**** Install GameDig ****" \ 102 | && npm install -g gamedig@5 103 | 104 | WORKDIR /app 105 | 106 | ## Add linuxgsm user 107 | RUN echo "**** Add linuxgsm user ****" \ 108 | && mkdir /data \ 109 | # Create the user 110 | && groupadd --gid $GID $USER \ 111 | && useradd --uid $UID --gid $GID -m $USER \ 112 | # 113 | # [Optional] Add sudo support. Omit if you don't need to install software after connecting. 114 | && echo $USER ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USER \ 115 | && chmod 0440 /etc/sudoers.d/$USER \ 116 | && chown $USER:$USER /data 117 | 118 | HEALTHCHECK --interval=1m --timeout=1m --start-period=2m --retries=1 CMD /app/entrypoint-healthcheck.sh || exit 1 119 | 120 | ## Download linuxgsm.sh 121 | RUN echo "**** Download linuxgsm.sh ****" \ 122 | && set -ex \ 123 | && curl -Lo linuxgsm.sh "https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/${LGSM_GITHUBBRANCH}/linuxgsm.sh" \ 124 | && chmod +x linuxgsm.sh 125 | 126 | RUN echo "**** Get LinuxGSM Modules ****" \ 127 | && git clone --filter=blob:none --no-checkout --sparse https://github.com/GameServerManagers/LinuxGSM.git \ 128 | && cd LinuxGSM \ 129 | && git sparse-checkout set --cone \ 130 | && git sparse-checkout set lgsm/modules \ 131 | && git checkout ${LGSM_GITHUBBRANCH} \ 132 | && mkdir -p /app/lgsm/modules \ 133 | && mv lgsm/modules/* /app/lgsm/modules \ 134 | && chmod +x /app/lgsm/modules/* \ 135 | && cd ../ \ 136 | && rm -rf LinuxGSM \ 137 | && chown -R $USER:$USER /app 138 | 139 | ARG CACHEBUST=1 140 | RUN echo "$CACHEBUST" 141 | 142 | COPY entrypoint.sh /app/entrypoint.sh 143 | COPY entrypoint-user.sh /app/entrypoint-user.sh 144 | COPY entrypoint-healthcheck.sh /app/entrypoint-healthcheck.sh 145 | 146 | ## Ensure entrypoint scripts have execute permissions 147 | RUN chmod +x /app/entrypoint.sh /app/entrypoint-user.sh /app/entrypoint-healthcheck.sh 148 | 149 | RUN date > /build-time.txt 150 | 151 | ENTRYPOINT ["/bin/bash", "./entrypoint.sh"] 152 | -------------------------------------------------------------------------------- /Dockerfile.ubuntu-2204: -------------------------------------------------------------------------------- 1 | # 2 | # LinuxGSM Base Dockerfile 3 | # 4 | # https://github.com/GameServerManagers/docker-linuxgsm 5 | # 6 | 7 | FROM ghcr.io/gameservermanagers/steamcmd:ubuntu-22.04 8 | 9 | USER root 10 | 11 | ## Remove steam user from upstream base image if present 12 | RUN if id -u steam >/dev/null 2>&1; then echo "Removing steam user from base image"; userdel -r steam || true; else echo "steam user not present"; fi 13 | 14 | LABEL maintainer="LinuxGSM " 15 | ENV DEBIAN_FRONTEND=noninteractive 16 | ENV TERM=xterm 17 | ENV LGSM_GITHUBUSER=GameServerManagers 18 | ENV LGSM_GITHUBREPO=LinuxGSM 19 | ENV LGSM_GITHUBBRANCH=master 20 | ENV LGSM_LOGDIR=/data/log 21 | ENV LGSM_SERVERFILES=/data/serverfiles 22 | ENV LGSM_DATADIR=/data/data 23 | ENV LGSM_CONFIG=/data/config-lgsm 24 | ENV LGSM_COMPRESSEDMAPSDIR=/data/Maps-Compressed 25 | ENV LGSM_DEV=false 26 | ENV GAMESERVER=jc2server 27 | ENV VALIDATE_ON_START=false 28 | ENV UPDATE_CHECK=60 29 | ENV USER=linuxgsm 30 | ENV UID=1000 31 | ENV GID=1000 32 | 33 | SHELL ["/bin/bash", "-o", "pipefail", "-c"] 34 | 35 | ## Install Base LinuxGSM Requirements 36 | RUN echo "**** Install Base LinuxGSM Requirements ****" \ 37 | && apt-get update \ 38 | && apt-get install -y software-properties-common \ 39 | && add-apt-repository multiverse \ 40 | && add-apt-repository ppa:git-core/ppa \ 41 | && apt-get update \ 42 | && apt-get install -y \ 43 | bc \ 44 | binutils \ 45 | bsdmainutils \ 46 | bzip2 \ 47 | ca-certificates \ 48 | cpio \ 49 | cron \ 50 | curl \ 51 | distro-info \ 52 | file \ 53 | git \ 54 | gnupg \ 55 | gosu \ 56 | gzip \ 57 | hostname \ 58 | jq \ 59 | lib32gcc-s1 \ 60 | lib32stdc++6 \ 61 | netcat \ 62 | pigz \ 63 | python3 \ 64 | sudo \ 65 | tar \ 66 | tmux \ 67 | unzip \ 68 | util-linux \ 69 | uuid-runtime \ 70 | wget \ 71 | xz-utils \ 72 | zstd \ 73 | # Docker Extras 74 | iproute2 \ 75 | iputils-ping \ 76 | nano \ 77 | vim \ 78 | && apt-get -y autoremove \ 79 | && apt-get -y clean \ 80 | && rm -rf /var/lib/apt/lists/* \ 81 | && rm -rf /tmp/* \ 82 | && rm -rf /var/tmp/* 83 | 84 | # Install Node.js 85 | RUN echo "**** Install Node.js ****" \ 86 | && set -uex \ 87 | && mkdir -p /etc/apt/keyrings \ 88 | && curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \ 89 | && NODE_MAJOR=20 \ 90 | && echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" > /etc/apt/sources.list.d/nodesource.list \ 91 | && apt-get update \ 92 | && apt-get install nodejs -y \ 93 | && apt-get -y autoremove \ 94 | && apt-get -y clean \ 95 | && rm -rf /var/lib/apt/lists/* \ 96 | && rm -rf /tmp/* \ 97 | && rm -rf /var/tmp/* \ 98 | && npm install -g npm@latest 99 | 100 | # Install GameDig https://docs.linuxgsm.com/requirements/gamedig 101 | RUN echo "**** Install GameDig ****" \ 102 | && npm install -g gamedig@5 103 | 104 | WORKDIR /app 105 | 106 | ## Add linuxgsm user 107 | RUN echo "**** Add linuxgsm user ****" \ 108 | && mkdir /data \ 109 | # Create the user 110 | && groupadd --gid $GID $USER \ 111 | && useradd --uid $UID --gid $GID -m $USER \ 112 | # 113 | # [Optional] Add sudo support. Omit if you don't need to install software after connecting. 114 | && echo $USER ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USER \ 115 | && chmod 0440 /etc/sudoers.d/$USER \ 116 | && chown $USER:$USER /data 117 | 118 | HEALTHCHECK --interval=1m --timeout=1m --start-period=2m --retries=1 CMD /app/entrypoint-healthcheck.sh || exit 1 119 | 120 | ## Download linuxgsm.sh 121 | RUN echo "**** Download linuxgsm.sh ****" \ 122 | && set -ex \ 123 | && curl -Lo linuxgsm.sh "https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/${LGSM_GITHUBBRANCH}/linuxgsm.sh" \ 124 | && chmod +x linuxgsm.sh 125 | 126 | RUN echo "**** Get LinuxGSM Modules ****" \ 127 | && git clone --filter=blob:none --no-checkout --sparse https://github.com/GameServerManagers/LinuxGSM.git \ 128 | && cd LinuxGSM \ 129 | && git sparse-checkout set --cone \ 130 | && git sparse-checkout set lgsm/modules \ 131 | && git checkout ${LGSM_GITHUBBRANCH} \ 132 | && mkdir -p /app/lgsm/modules \ 133 | && mv lgsm/modules/* /app/lgsm/modules \ 134 | && chmod +x /app/lgsm/modules/* \ 135 | && cd ../ \ 136 | && rm -rf LinuxGSM \ 137 | && chown -R $USER:$USER /app 138 | 139 | ARG CACHEBUST=1 140 | RUN echo "$CACHEBUST" 141 | 142 | COPY entrypoint.sh /app/entrypoint.sh 143 | COPY entrypoint-user.sh /app/entrypoint-user.sh 144 | COPY entrypoint-healthcheck.sh /app/entrypoint-healthcheck.sh 145 | 146 | ## Ensure entrypoint scripts have execute permissions 147 | RUN chmod +x /app/entrypoint.sh /app/entrypoint-user.sh /app/entrypoint-healthcheck.sh 148 | 149 | RUN date > /build-time.txt 150 | 151 | ENTRYPOINT ["/bin/bash", "./entrypoint.sh"] 152 | -------------------------------------------------------------------------------- /Dockerfile.ubuntu-2404: -------------------------------------------------------------------------------- 1 | # 2 | # LinuxGSM Base Dockerfile 3 | # 4 | # https://github.com/GameServerManagers/docker-linuxgsm 5 | # 6 | 7 | FROM ghcr.io/gameservermanagers/steamcmd:ubuntu-24.04 8 | 9 | USER root 10 | 11 | ## Remove steam user from upstream base image if present 12 | RUN if id -u steam >/dev/null 2>&1; then echo "Removing steam user from base image"; userdel -r steam || true; else echo "steam user not present"; fi 13 | 14 | LABEL maintainer="LinuxGSM " 15 | ENV DEBIAN_FRONTEND=noninteractive 16 | ENV TERM=xterm 17 | ENV LGSM_GITHUBUSER=GameServerManagers 18 | ENV LGSM_GITHUBREPO=LinuxGSM 19 | ENV LGSM_GITHUBBRANCH=master 20 | ENV LGSM_LOGDIR=/data/log 21 | ENV LGSM_SERVERFILES=/data/serverfiles 22 | ENV LGSM_DATADIR=/data/data 23 | ENV LGSM_CONFIG=/data/config-lgsm 24 | ENV LGSM_COMPRESSEDMAPSDIR=/data/Maps-Compressed 25 | ENV LGSM_DEV=false 26 | ENV GAMESERVER=jc2server 27 | ENV VALIDATE_ON_START=false 28 | ENV UPDATE_CHECK=60 29 | ENV USER=linuxgsm 30 | ENV UID=1000 31 | ENV GID=1000 32 | 33 | SHELL ["/bin/bash", "-o", "pipefail", "-c"] 34 | 35 | ## Install Base LinuxGSM Requirements 36 | RUN echo "**** Install Base LinuxGSM Requirements ****" \ 37 | && apt-get update \ 38 | && apt-get install -y software-properties-common \ 39 | && add-apt-repository multiverse \ 40 | && add-apt-repository ppa:git-core/ppa \ 41 | && apt-get update \ 42 | && apt-get install -y \ 43 | bc \ 44 | binutils \ 45 | bsdmainutils \ 46 | bzip2 \ 47 | ca-certificates \ 48 | cpio \ 49 | cron \ 50 | curl \ 51 | distro-info \ 52 | file \ 53 | git \ 54 | gnupg \ 55 | gosu \ 56 | gzip \ 57 | hostname \ 58 | jq \ 59 | lib32gcc-s1 \ 60 | lib32stdc++6 \ 61 | netcat-openbsd \ 62 | pigz \ 63 | python3 \ 64 | sudo \ 65 | tar \ 66 | tmux \ 67 | unzip \ 68 | util-linux \ 69 | uuid-runtime \ 70 | wget \ 71 | xz-utils \ 72 | zstd \ 73 | # Docker Extras 74 | iproute2 \ 75 | iputils-ping \ 76 | nano \ 77 | vim \ 78 | && apt-get -y autoremove \ 79 | && apt-get -y clean \ 80 | && rm -rf /var/lib/apt/lists/* \ 81 | && rm -rf /tmp/* \ 82 | && rm -rf /var/tmp/* 83 | 84 | # Install Node.js 85 | RUN echo "**** Install Node.js ****" \ 86 | && set -uex \ 87 | && mkdir -p /etc/apt/keyrings \ 88 | && curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \ 89 | && NODE_MAJOR=20 \ 90 | && echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" > /etc/apt/sources.list.d/nodesource.list \ 91 | && apt-get update \ 92 | && apt-get install nodejs -y \ 93 | && apt-get -y autoremove \ 94 | && apt-get -y clean \ 95 | && rm -rf /var/lib/apt/lists/* \ 96 | && rm -rf /tmp/* \ 97 | && rm -rf /var/tmp/* \ 98 | && npm install -g npm@latest 99 | 100 | # Install GameDig https://docs.linuxgsm.com/requirements/gamedig 101 | RUN echo "**** Install GameDig ****" \ 102 | && npm install -g gamedig@5 103 | 104 | WORKDIR /app 105 | 106 | ## Add linuxgsm user 107 | RUN echo "**** Add linuxgsm user ****" \ 108 | && mkdir /data \ 109 | # Create the user 110 | && groupadd --gid $GID $USER \ 111 | && useradd --uid $UID --gid $GID -m $USER \ 112 | # 113 | # [Optional] Add sudo support. Omit if you don't need to install software after connecting. 114 | && echo $USER ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USER \ 115 | && chmod 0440 /etc/sudoers.d/$USER \ 116 | && chown $USER:$USER /data 117 | 118 | HEALTHCHECK --interval=1m --timeout=1m --start-period=2m --retries=1 CMD /app/entrypoint-healthcheck.sh || exit 1 119 | 120 | ## Download linuxgsm.sh 121 | RUN echo "**** Download linuxgsm.sh ****" \ 122 | && set -ex \ 123 | && curl -Lo linuxgsm.sh "https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/${LGSM_GITHUBBRANCH}/linuxgsm.sh" \ 124 | && chmod +x linuxgsm.sh 125 | 126 | RUN echo "**** Get LinuxGSM Modules ****" \ 127 | && git clone --filter=blob:none --no-checkout --sparse https://github.com/GameServerManagers/LinuxGSM.git \ 128 | && cd LinuxGSM \ 129 | && git sparse-checkout set --cone \ 130 | && git sparse-checkout set lgsm/modules \ 131 | && git checkout ${LGSM_GITHUBBRANCH} \ 132 | && mkdir -p /app/lgsm/modules \ 133 | && mv lgsm/modules/* /app/lgsm/modules \ 134 | && chmod +x /app/lgsm/modules/* \ 135 | && cd ../ \ 136 | && rm -rf LinuxGSM \ 137 | && chown -R $USER:$USER /app 138 | 139 | ARG CACHEBUST=1 140 | RUN echo "$CACHEBUST" 141 | 142 | COPY entrypoint.sh /app/entrypoint.sh 143 | COPY entrypoint-user.sh /app/entrypoint-user.sh 144 | COPY entrypoint-healthcheck.sh /app/entrypoint-healthcheck.sh 145 | 146 | ## Ensure entrypoint scripts have execute permissions 147 | RUN chmod +x /app/entrypoint.sh /app/entrypoint-user.sh /app/entrypoint-healthcheck.sh 148 | 149 | RUN date > /build-time.txt 150 | 151 | ENTRYPOINT ["/bin/bash", "./entrypoint.sh"] 152 | -------------------------------------------------------------------------------- /.github/workflows/action-docker-publish.yml: -------------------------------------------------------------------------------- 1 | name: Docker Publish 2 | on: 3 | workflow_dispatch: 4 | push: 5 | branches: 6 | - main 7 | paths: 8 | - Dockerfile* 9 | schedule: 10 | - cron: "0 1 * * 6" 11 | 12 | jobs: 13 | build-ubuntu-2404: 14 | name: Build Ubuntu 24.04 15 | runs-on: ubuntu-latest 16 | permissions: 17 | packages: write 18 | contents: read 19 | attestations: write 20 | id-token: write 21 | steps: 22 | - name: Checkout 23 | uses: actions/checkout@v5 24 | 25 | - name: Setup QEMU 26 | uses: docker/setup-qemu-action@v3 27 | 28 | - name: Login to Docker Hub 29 | uses: docker/login-action@v3 30 | with: 31 | username: ${{ secrets.DOCKER_HUB_USERNAME }} 32 | password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} 33 | 34 | - name: Login to GitHub Container Registry 35 | uses: docker/login-action@v3 36 | with: 37 | registry: ghcr.io 38 | username: ${{ github.actor }} 39 | password: ${{ secrets.GITHUB_TOKEN }} 40 | 41 | - name: Extract metadata (tags, labels) for Docker 42 | id: meta 43 | uses: docker/metadata-action@v5 44 | with: 45 | images: | 46 | gameservermanagers/linuxgsm 47 | ghcr.io/gameservermanagers/linuxgsm 48 | tags: | 49 | latest 50 | ubuntu 51 | ubuntu-24.04 52 | 53 | - name: Build and push (Ubuntu 24.04) 54 | uses: docker/build-push-action@v6 55 | with: 56 | context: . 57 | file: ./Dockerfile.ubuntu-2404 58 | platforms: linux/amd64 59 | push: true 60 | tags: ${{ steps.meta.outputs.tags }} 61 | labels: ${{ steps.meta.outputs.labels }} 62 | 63 | build-ubuntu-2204: 64 | name: Build Ubuntu 22.04 65 | runs-on: ubuntu-latest 66 | permissions: 67 | packages: write 68 | contents: read 69 | attestations: write 70 | id-token: write 71 | steps: 72 | - name: Checkout 73 | uses: actions/checkout@v5 74 | 75 | - name: Setup QEMU 76 | uses: docker/setup-qemu-action@v3 77 | 78 | - name: Login to Docker Hub 79 | uses: docker/login-action@v3 80 | with: 81 | username: ${{ secrets.DOCKER_HUB_USERNAME }} 82 | password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} 83 | 84 | - name: Login to GitHub Container Registry 85 | uses: docker/login-action@v3 86 | with: 87 | registry: ghcr.io 88 | username: ${{ github.actor }} 89 | password: ${{ secrets.GITHUB_TOKEN }} 90 | 91 | - name: Extract metadata (tags, labels) for Docker 92 | id: meta 93 | uses: docker/metadata-action@v5 94 | with: 95 | images: | 96 | gameservermanagers/linuxgsm 97 | ghcr.io/gameservermanagers/linuxgsm 98 | tags: | 99 | ubuntu-22.04 100 | 101 | - name: Build and push (Ubuntu 22.04) 102 | uses: docker/build-push-action@v6 103 | with: 104 | context: . 105 | file: ./Dockerfile.ubuntu-2204 106 | platforms: linux/amd64 107 | push: true 108 | tags: ${{ steps.meta.outputs.tags }} 109 | labels: ${{ steps.meta.outputs.labels }} 110 | 111 | build-ubuntu-2004: 112 | name: Build Ubuntu 20.04 113 | runs-on: ubuntu-latest 114 | permissions: 115 | packages: write 116 | contents: read 117 | attestations: write 118 | id-token: write 119 | steps: 120 | - name: Checkout 121 | uses: actions/checkout@v5 122 | 123 | - name: Setup QEMU 124 | uses: docker/setup-qemu-action@v3 125 | 126 | - name: Login to Docker Hub 127 | uses: docker/login-action@v3 128 | with: 129 | username: ${{ secrets.DOCKER_HUB_USERNAME }} 130 | password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} 131 | 132 | - name: Login to GitHub Container Registry 133 | uses: docker/login-action@v3 134 | with: 135 | registry: ghcr.io 136 | username: ${{ github.actor }} 137 | password: ${{ secrets.GITHUB_TOKEN }} 138 | 139 | - name: Extract metadata (tags, labels) for Docker 140 | id: meta 141 | uses: docker/metadata-action@v5 142 | with: 143 | images: | 144 | gameservermanagers/linuxgsm 145 | ghcr.io/gameservermanagers/linuxgsm 146 | tags: | 147 | ubuntu-20.04 148 | 149 | - name: Build and push (Ubuntu 20.04) 150 | uses: docker/build-push-action@v6 151 | with: 152 | context: . 153 | file: ./Dockerfile.ubuntu-2004 154 | platforms: linux/amd64 155 | push: true 156 | tags: ${{ steps.meta.outputs.tags }} 157 | labels: ${{ steps.meta.outputs.labels }} 158 | 159 | package-cleanup: 160 | name: Cleanup Old GitHub Packages 161 | needs: [build-ubuntu-2004, build-ubuntu-2204, build-ubuntu-2404] 162 | runs-on: ubuntu-latest 163 | steps: 164 | - name: Delete Package Versions 165 | uses: actions/delete-package-versions@v5 166 | with: 167 | package-name: linuxgsm 168 | package-type: container 169 | min-versions-to-keep: 1 170 | delete-only-untagged-versions: true 171 | --------------------------------------------------------------------------------