From 457d4e3f67c1b9e597637af565cf7486bd89c890 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Thu, 14 Nov 2019 10:14:56 +0000 Subject: [PATCH 01/10] Update LICENSE --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 53eca86..46abbde 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2017 Andrey Shmakov +Copyright (c) 2017-2020 Daniel Gibbs Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From ec4c33cebf84c847cdbfc6336b991c9b805a0366 Mon Sep 17 00:00:00 2001 From: Johannes Rothmayr Date: Wed, 25 Mar 2020 15:31:18 +0100 Subject: [PATCH 02/10] Fix dependencies Lgsm uses the 'ip' command several times. The docker image is missing this command. The missing command is part of the package 'iproute2'. --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 4c94e38..d24f953 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,6 +17,7 @@ ENV LANG en_US.utf8 RUN dpkg --add-architecture i386 && \ apt update -y && \ apt install -y \ + iproute2 \ mailutils \ postfix \ curl \ From 6e983aae9401d7077c423afcc99fe179c1e6d6ec Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Sun, 12 Apr 2020 21:35:54 +0100 Subject: [PATCH 03/10] Update Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index d24f953..c25870b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,7 +17,7 @@ ENV LANG en_US.utf8 RUN dpkg --add-architecture i386 && \ apt update -y && \ apt install -y \ - iproute2 \ + iproute2 \ mailutils \ postfix \ curl \ From ca92a91053c7d162b313fcdbdbc0f39ea5d3c85a Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Sun, 12 Apr 2020 21:37:41 +0100 Subject: [PATCH 04/10] Update Dockerfile --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index c25870b..dbdc200 100644 --- a/Dockerfile +++ b/Dockerfile @@ -43,6 +43,8 @@ RUN dpkg --add-architecture i386 && \ libncurses5:i386 \ libcurl4-gnutls-dev:i386 \ libstdc++5:i386 \ + netcat \ + lib32stdc++6 \ lib32tinfo5 \ xz-utils \ zlib1g:i386 \ From bc1d2a49dc07a8e4fabb76c05860cf6b14ba5f19 Mon Sep 17 00:00:00 2001 From: Jason Lash Date: Mon, 8 Jun 2020 18:31:53 -0600 Subject: [PATCH 05/10] Removed redundant adduser call which was preventing docker build from succeeding. --- Dockerfile | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/Dockerfile b/Dockerfile index dbdc200..a6b7762 100644 --- a/Dockerfile +++ b/Dockerfile @@ -69,20 +69,6 @@ RUN dpkg --add-architecture i386 && \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* -# Add the linuxgsm user -RUN adduser \ - --disabled-login \ - --disabled-password \ - --shell /bin/bash \ - --gecos "" \ - linuxgsm \ - && usermod -G tty linuxgsm \ - && chown -R linuxgsm:linuxgsm /home/linuxgsm - -# Switch to the user linuxgsm -USER linuxgsm - - ## linuxgsm.sh RUN wget https://linuxgsm.com/dl/linuxgsm.sh From c0bd3389e2feee14171fa84cbed521b9f936b19c Mon Sep 17 00:00:00 2001 From: Sam Gleske <875669+samrocketman@users.noreply.github.com> Date: Sat, 13 Feb 2021 17:59:32 -0500 Subject: [PATCH 06/10] style: Better shell debugging with Docker builds Every `RUN` step in Docker launches a `/bin/sh` subshell. Because of this, you can use standard shell options supported by `/bin/sh`. > **Please Note**: I have not added or removed anything from the Docker > image. I just added a few debug options to make build output more > clear. Changes made: - Every `RUN` step starts with `set -ex`. Refer to [The Set Builtin in the Bash manual][1] to learn more about `set -e` and `set -x` respectively. - Because `set -ex` is used, semi-colon commands and ampersand separated commands have the same effect... bash will exit on first error. So I changed all of the commands to be semi-colon separated. ```bash command1 && command2 # the following means the exact same thing set -ex; command1; command2; ``` - I de-indented all of the `RUN` commands. It's my personal opinion that all commands should be de-indented unless they're sub-options to a preceding command (like the package list on `apt-get install`). Every Dockerfile command should be separated by a blank newline for readability. - In the `apt-get install` package list which lists one package per line, I sorted the package list. How has this changed behavior? When you run the following command: docker build . -t lgsm You will now see shell commands show up in red as they are executed. e.g. you'll see every `apt-get` command, `rm`, and any other commands run as they're executed. So if one of the commands throws an error you'll see which command was the problem, specifically. [1]: https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html#The-Set-Builtin --- Dockerfile | 141 +++++++++++++++++++++++++++++------------------------ 1 file changed, 76 insertions(+), 65 deletions(-) diff --git a/Dockerfile b/Dockerfile index a6b7762..83b49db 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,85 +5,95 @@ # FROM ubuntu:18.04 + LABEL maintainer="LinuxGSM " ENV DEBIAN_FRONTEND noninteractive -RUN apt-get update && apt-get install -y locales && rm -rf /var/lib/apt/lists/* \ - && localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 +RUN set -ex; \ +apt-get update; \ +apt-get install -y locales; \ +rm -rf /var/lib/apt/lists/*; \ +localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 + ENV LANG en_US.utf8 ## Base System -RUN dpkg --add-architecture i386 && \ - apt update -y && \ - apt install -y \ - iproute2 \ - mailutils \ - postfix \ - curl \ - wget \ - file \ - bzip2 \ - gzip \ - unzip \ - bsdmainutils \ - python \ - util-linux \ - binutils \ - bc \ - jq \ - tmux \ - lib32gcc1 \ - libstdc++6 \ - libstdc++6:i386 \ - apt-transport-https \ - ca-certificates \ - telnet \ - expect \ - libncurses5:i386 \ - libcurl4-gnutls-dev:i386 \ - libstdc++5:i386 \ - netcat \ - lib32stdc++6 \ - lib32tinfo5 \ - xz-utils \ - zlib1g:i386 \ - libldap-2.4-2:i386 \ - lib32z1 \ - default-jre \ - speex:i386 \ - libtbb2 \ - libxrandr2:i386 \ - libglu1-mesa:i386 \ - libxtst6:i386 \ - libusb-1.0-0:i386 \ - libopenal1:i386 \ - libpulse0:i386 \ - libdbus-glib-1-2:i386 \ - libnm-glib4:i386 \ - zlib1g \ - libssl1.0.0:i386 \ - libtcmalloc-minimal4:i386 \ - libsdl1.2debian \ - libnm-glib-dev:i386 \ - && apt-get clean \ - && rm -rf /var/lib/apt/lists/* +RUN set -ex; \ +dpkg --add-architecture i386; \ +apt update -y; \ +apt install -y \ + apt-transport-https \ + bc \ + binutils \ + bsdmainutils \ + bzip2 \ + ca-certificates \ + curl \ + default-jre \ + expect \ + file \ + gzip \ + iproute2 \ + jq \ + lib32gcc1 \ + lib32stdc++6 \ + lib32tinfo5 \ + lib32z1 \ + libcurl4-gnutls-dev:i386 \ + libdbus-glib-1-2:i386 \ + libglu1-mesa:i386 \ + libldap-2.4-2:i386 \ + libncurses5:i386 \ + libnm-glib-dev:i386 \ + libnm-glib4:i386 \ + libopenal1:i386 \ + libpulse0:i386 \ + libsdl1.2debian \ + libssl1.0.0:i386 \ + libstdc++5:i386 \ + libstdc++6 \ + libstdc++6:i386 \ + libtbb2 \ + libtcmalloc-minimal4:i386 \ + libusb-1.0-0:i386 \ + libxrandr2:i386 \ + libxtst6:i386 \ + mailutils \ + netcat \ + postfix \ + python \ + speex:i386 \ + telnet \ + tmux \ + unzip \ + util-linux \ + wget \ + xz-utils \ + zlib1g \ + zlib1g:i386; \ +apt-get clean; \ +rm -rf /var/lib/apt/lists/* ## linuxgsm.sh -RUN wget https://linuxgsm.com/dl/linuxgsm.sh +RUN set -ex; \ +wget https://linuxgsm.com/dl/linuxgsm.sh ## user config -RUN groupadd -g 750 -o linuxgsm && \ - adduser --uid 750 --disabled-password --gecos "" --ingroup linuxgsm linuxgsm && \ - chown linuxgsm:linuxgsm /linuxgsm.sh && \ - chmod +x /linuxgsm.sh && \ - cp /linuxgsm.sh /home/linuxgsm/linuxgsm.sh && \ - usermod -G tty linuxgsm && \ - chown -R linuxgsm:linuxgsm /home/linuxgsm/ && \ - chmod 755 /home/linuxgsm +RUN set -ex; \ +groupadd -g 750 -o linuxgsm; \ +adduser --uid 750 --disabled-password --gecos "" --ingroup linuxgsm linuxgsm; \ +chown linuxgsm:linuxgsm /linuxgsm.sh; \ +chmod +x /linuxgsm.sh; \ +cp /linuxgsm.sh /home/linuxgsm/linuxgsm.sh; \ +usermod -G tty linuxgsm; \ +chown -R linuxgsm:linuxgsm /home/linuxgsm/; \ +chmod 755 /home/linuxgsm USER linuxgsm + WORKDIR /home/linuxgsm + VOLUME [ "/home/linuxgsm" ] # need use xterm for LinuxGSM @@ -93,4 +103,5 @@ ENV TERM=xterm ENV PATH=$PATH:/home/linuxgsm COPY entrypoint.sh /entrypoint.sh + ENTRYPOINT ["bash","/entrypoint.sh" ] From 69d9442f7351c3ace53f58f197cdcbe5272107de Mon Sep 17 00:00:00 2001 From: Matthew Clairmont Date: Tue, 16 Feb 2021 20:09:10 -0500 Subject: [PATCH 07/10] add vi to apt install --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 83b49db..6749837 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,6 +23,7 @@ RUN set -ex; \ dpkg --add-architecture i386; \ apt update -y; \ apt install -y \ + vi \ apt-transport-https \ bc \ binutils \ From b486d18e6ea9ba6001a75d8fe87fe7e5732768cd Mon Sep 17 00:00:00 2001 From: Matthew Clairmont Date: Tue, 16 Feb 2021 21:20:16 -0500 Subject: [PATCH 08/10] change vi to vim and add missing dep --- Dockerfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 6749837..18cbd0b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,12 +18,14 @@ localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 ENV LANG en_US.utf8 + + ## Base System RUN set -ex; \ dpkg --add-architecture i386; \ apt update -y; \ apt install -y \ - vi \ + vim \ apt-transport-https \ bc \ binutils \ @@ -51,6 +53,7 @@ apt install -y \ libopenal1:i386 \ libpulse0:i386 \ libsdl1.2debian \ + libsdl2-2.0-0:i386 \ libssl1.0.0:i386 \ libstdc++5:i386 \ libstdc++6 \ From e1142cfd1994b96bf0a8ce6cf57391afaf491551 Mon Sep 17 00:00:00 2001 From: Matthew Clairmont Date: Thu, 18 Feb 2021 09:42:36 -0500 Subject: [PATCH 09/10] removed unnecessary newlines --- Dockerfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 18cbd0b..04839a0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,8 +18,6 @@ localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 ENV LANG en_US.utf8 - - ## Base System RUN set -ex; \ dpkg --add-architecture i386; \ From 396e313d693950f81ed548b6b9425886670b6ff0 Mon Sep 17 00:00:00 2001 From: Matt Clairmont Date: Fri, 19 Mar 2021 14:43:08 -0400 Subject: [PATCH 10/10] auto install lgsm with docker-compose --- Dockerfile | 11 ++++++++--- README.md | 3 ++- compose-dev.md | 12 ++++++++++++ docker-compose.yaml | 15 +++++++++++++++ entrypoint.sh | 4 +++- installserver.sh | 5 +++++ 6 files changed, 45 insertions(+), 5 deletions(-) create mode 100644 compose-dev.md create mode 100644 docker-compose.yaml create mode 100644 installserver.sh diff --git a/Dockerfile b/Dockerfile index 04839a0..446dbc8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -70,6 +70,7 @@ apt install -y \ tmux \ unzip \ util-linux \ + vim \ wget \ xz-utils \ zlib1g \ @@ -90,7 +91,7 @@ chmod +x /linuxgsm.sh; \ cp /linuxgsm.sh /home/linuxgsm/linuxgsm.sh; \ usermod -G tty linuxgsm; \ chown -R linuxgsm:linuxgsm /home/linuxgsm/; \ -chmod 755 /home/linuxgsm +chmod 777 /home/linuxgsm USER linuxgsm @@ -104,6 +105,10 @@ ENV TERM=xterm ## Docker Details ENV PATH=$PATH:/home/linuxgsm -COPY entrypoint.sh /entrypoint.sh +COPY --chown=linuxgsm:linuxgsm entrypoint.sh installserver.sh /home/linuxgsm + +RUN chmod +x *.sh + +ENTRYPOINT ["bash","./entrypoint.sh" ] -ENTRYPOINT ["bash","/entrypoint.sh" ] +CMD ["./installserver.sh"] diff --git a/README.md b/README.md index d7c7e53..a437003 100644 --- a/README.md +++ b/README.md @@ -24,5 +24,6 @@ This will work both on linux and Docker for Windows. With Docker for Windows, sk ```bash $ mkdir -p /path/to/lgsm && sudo chown -R 750:750 /path/to/lgsm -$ docker run --name lgsm-docker --restart always --net=host --hostname LGSM -it -v "/path/to/lgsm:/home/lgsm/" gameservermanagers/linuxgsm-docker +$ docker run -d --name lgsm-docker --restart always --net=host --hostname LGSM -it -v "/path/to/lgsm:/home/lgsm/" gameservermanagers/linuxgsm-docker ``` +To expose multiple game ports for your server use the format `-p :`. For example `docker run -d --name -p 12203-12204:12203-12204 --restart-always --net=host gameservermanagers/linuxgsm-docker ` diff --git a/compose-dev.md b/compose-dev.md new file mode 100644 index 0000000..bc699ab --- /dev/null +++ b/compose-dev.md @@ -0,0 +1,12 @@ +## DOCKER COMPOSE DRAFT + +# Overview +The docker image dockclair/lgsm-dev has been modified for use with docker-compose by adding a bootstrap-like sh script. + +For this to work the environment variable 'GAMESERVER' needs to be set and match +a valid (supported) LinuxGSM server. + +All questions posed to the user will be answered with the default 'yes' + +# Issues +No PID 1 constantly running for the container to remain up even with -d or the entrypoint's use of tmux. We need a process to remain running as PID 1 so it doesn't die immediately after starting the game server. diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..3186b66 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,15 @@ +version: '3.9' + +services: + lgsm_test: + image: dockclair/lgsm-dev + environment: + - GAMESERVER=vhserver + ports: + - 2456:2456 + volumes: + - type: volume + target: /home/linuxgsm + +volumes: + lgsm: diff --git a/entrypoint.sh b/entrypoint.sh index b48d25b..e7e7f39 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -29,6 +29,8 @@ else # when invoked via docker run # but requires -it or at least -t tmux set -g status off && tmux attach 2> /dev/null + + fi -exit 0 \ No newline at end of file +exit 0 diff --git a/installserver.sh b/installserver.sh new file mode 100644 index 0000000..1ae90e3 --- /dev/null +++ b/installserver.sh @@ -0,0 +1,5 @@ +#!/bin/bash +./linuxgsm.sh $GAMESERVER +yes | ./$GAMESERVER install +./$GAMESERVER start +