From 4b56b1e2d3a9531aa592d36a292c8703daa28ae6 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Wed, 31 May 2023 18:58:37 +0100 Subject: [PATCH] feat: update Dockerfiles and entrypoint scripts - Update Node.js installation to version 18.x - Add gosu package for better user switching - Remove s6 overlay installation - Modify entrypoint scripts to use gosu instead of s6-setuidgid - Add healthcheck script using gosu BREAKING CHANGE: This commit removes the s6 overlay installation from the Dockerfiles and modifies the entrypoint scripts to use gosu instead of s6-setuidgid. This may affect users who rely on the previous behavior. --- Dockerfile.ubuntu-1804 | 21 ++++----------------- Dockerfile.ubuntu-2004 | 21 ++++----------------- Dockerfile.ubuntu-2204 | 21 ++++++--------------- entrypoint-healthcheck.sh | 4 ++-- entrypoint.sh | 6 +++--- 5 files changed, 19 insertions(+), 54 deletions(-) diff --git a/Dockerfile.ubuntu-1804 b/Dockerfile.ubuntu-1804 index 3e2a610..2cf79d1 100644 --- a/Dockerfile.ubuntu-1804 +++ b/Dockerfile.ubuntu-1804 @@ -7,8 +7,6 @@ FROM gameservermanagers/steamcmd:ubuntu-18.04 LABEL maintainer="LinuxGSM " -ARG S6_OVERLAY_VERSION=3.1.3.0 -ARG OVERLAY_ARCH="amd64" ENV DEBIAN_FRONTEND noninteractive ENV TERM=xterm ENV LGSM_GITHUBUSER=GameServerManagers @@ -41,6 +39,7 @@ RUN echo "**** Install Base LinuxGSM Requirements ****" \ distro-info \ file \ git \ + gosu \ gzip \ hostname \ jq \ @@ -68,7 +67,7 @@ RUN echo "**** Install Base LinuxGSM Requirements ****" \ # Install Node.js RUN echo "**** Install Node.js ****" \ - && curl -sL https://deb.nodesource.com/setup_16.x | bash - \ + && curl -sL https://deb.nodesource.com/setup_18.x | bash - \ && apt-get update \ && apt-get install -y nodejs \ && apt-get -y autoremove \ @@ -81,18 +80,6 @@ RUN echo "**** Install Node.js ****" \ RUN echo "**** Install GameDig ****" \ && npm install -g gamedig -# Install s6 overlay -ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz /tmp -RUN tar -C / -Jxpf /tmp/s6-overlay-noarch.tar.xz -ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-x86_64.tar.xz /tmp -RUN tar -C / -Jxpf /tmp/s6-overlay-x86_64.tar.xz -ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-symlinks-noarch.tar.xz /tmp -RUN tar -C / -Jxpf /tmp/s6-overlay-symlinks-noarch.tar.xz -ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-symlinks-arch.tar.xz /tmp -RUN tar -C / -Jxpf /tmp/s6-overlay-symlinks-arch.tar.xz - -RUN date > /build-time.txt - WORKDIR /linuxgsm ## Add linuxgsm user @@ -129,8 +116,8 @@ RUN echo "**** Get LinuxGSM Modules ****" \ COPY entrypoint.sh /linuxgsm/entrypoint.sh COPY entrypoint-user.sh /linuxgsm/entrypoint-user.sh +COPY entrypoint-healthcheck.sh /linuxgsm/entrypoint-healthcheck.sh RUN date > /build-time.txt -ENTRYPOINT ["/init"] -CMD [ "./entrypoint.sh" ] +ENTRYPOINT ["/bin/bash", "./entrypoint.sh"] diff --git a/Dockerfile.ubuntu-2004 b/Dockerfile.ubuntu-2004 index 9da022b..bf2cdbc 100644 --- a/Dockerfile.ubuntu-2004 +++ b/Dockerfile.ubuntu-2004 @@ -7,8 +7,6 @@ FROM gameservermanagers/steamcmd:ubuntu-20.04 LABEL maintainer="LinuxGSM " -ARG S6_OVERLAY_VERSION=3.1.3.0 -ARG OVERLAY_ARCH="amd64" ENV DEBIAN_FRONTEND noninteractive ENV TERM=xterm ENV LGSM_GITHUBUSER=GameServerManagers @@ -41,6 +39,7 @@ RUN echo "**** Install Base LinuxGSM Requirements ****" \ distro-info \ file \ git \ + gosu \ gzip \ hostname \ jq \ @@ -68,7 +67,7 @@ RUN echo "**** Install Base LinuxGSM Requirements ****" \ # Install Node.js RUN echo "**** Install Node.js ****" \ - && curl -sL https://deb.nodesource.com/setup_16.x | bash - \ + && curl -sL https://deb.nodesource.com/setup_18.x | bash - \ && apt-get update \ && apt-get install -y nodejs \ && apt-get -y autoremove \ @@ -81,18 +80,6 @@ RUN echo "**** Install Node.js ****" \ RUN echo "**** Install GameDig ****" \ && npm install -g gamedig -# Install s6 overlay -ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz /tmp -RUN tar -C / -Jxpf /tmp/s6-overlay-noarch.tar.xz -ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-x86_64.tar.xz /tmp -RUN tar -C / -Jxpf /tmp/s6-overlay-x86_64.tar.xz -ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-symlinks-noarch.tar.xz /tmp -RUN tar -C / -Jxpf /tmp/s6-overlay-symlinks-noarch.tar.xz -ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-symlinks-arch.tar.xz /tmp -RUN tar -C / -Jxpf /tmp/s6-overlay-symlinks-arch.tar.xz - -RUN date > /build-time.txt - WORKDIR /linuxgsm ## Add linuxgsm user @@ -129,8 +116,8 @@ RUN echo "**** Get LinuxGSM Modules ****" \ COPY entrypoint.sh /linuxgsm/entrypoint.sh COPY entrypoint-user.sh /linuxgsm/entrypoint-user.sh +COPY entrypoint-healthcheck.sh /linuxgsm/entrypoint-healthcheck.sh RUN date > /build-time.txt -ENTRYPOINT ["/init"] -CMD [ "./entrypoint.sh" ] +ENTRYPOINT ["/bin/bash", "./entrypoint.sh"] diff --git a/Dockerfile.ubuntu-2204 b/Dockerfile.ubuntu-2204 index 10f1ff2..7c4a09d 100644 --- a/Dockerfile.ubuntu-2204 +++ b/Dockerfile.ubuntu-2204 @@ -7,8 +7,6 @@ FROM gameservermanagers/steamcmd:ubuntu-22.04 LABEL maintainer="LinuxGSM " -ARG S6_OVERLAY_VERSION=3.1.3.0 -ARG OVERLAY_ARCH="amd64" ENV DEBIAN_FRONTEND noninteractive ENV TERM=xterm ENV LGSM_GITHUBUSER=GameServerManagers @@ -41,6 +39,7 @@ RUN echo "**** Install Base LinuxGSM Requirements ****" \ distro-info \ file \ git \ + gosu \ gzip \ hostname \ jq \ @@ -68,7 +67,7 @@ RUN echo "**** Install Base LinuxGSM Requirements ****" \ # Install Node.js RUN echo "**** Install Node.js ****" \ - && curl -sL https://deb.nodesource.com/setup_16.x | bash - \ + && curl -sL https://deb.nodesource.com/setup_18.x | bash - \ && apt-get update \ && apt-get install -y nodejs \ && apt-get -y autoremove \ @@ -81,16 +80,6 @@ RUN echo "**** Install Node.js ****" \ RUN echo "**** Install GameDig ****" \ && npm install -g gamedig -# Install s6 overlay -ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz /tmp -RUN tar -C / -Jxpf /tmp/s6-overlay-noarch.tar.xz -ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-x86_64.tar.xz /tmp -RUN tar -C / -Jxpf /tmp/s6-overlay-x86_64.tar.xz -ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-symlinks-noarch.tar.xz /tmp -RUN tar -C / -Jxpf /tmp/s6-overlay-symlinks-noarch.tar.xz -ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-symlinks-arch.tar.xz /tmp -RUN tar -C / -Jxpf /tmp/s6-overlay-symlinks-arch.tar.xz - WORKDIR /linuxgsm ## Add linuxgsm user @@ -125,11 +114,13 @@ RUN echo "**** Get LinuxGSM Modules ****" \ && rm -rf /linuxgsm/LinuxGSM \ && chown -R $USERNAME:$USERNAME /linuxgsm +ARG CACHEBUST=1 +RUN echo "$CACHEBUST" + COPY entrypoint.sh /linuxgsm/entrypoint.sh COPY entrypoint-user.sh /linuxgsm/entrypoint-user.sh COPY entrypoint-healthcheck.sh /linuxgsm/entrypoint-healthcheck.sh RUN date > /build-time.txt -ENTRYPOINT ["/init"] -CMD [ "./entrypoint.sh" ] +ENTRYPOINT ["/bin/bash", "./entrypoint.sh"] diff --git a/entrypoint-healthcheck.sh b/entrypoint-healthcheck.sh index e4a35c9..94a9618 100755 --- a/entrypoint-healthcheck.sh +++ b/entrypoint-healthcheck.sh @@ -1,2 +1,2 @@ -#!/usr/bin/with-contenv bas -exec s6-setuidgid ${USERNAME} /linuxgsm/*server monitor || exit 1 +#!/bin/bash +exec gosu ${USERNAME} /linuxgsm/*server monitor || exit 1 diff --git a/entrypoint.sh b/entrypoint.sh index a8da437..6bea9e4 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,9 +1,9 @@ -#!/usr/bin/with-contenv bash +#!/bin/bash exit_handler() { # Execute the shutdown commands echo -e "stopping ${GAMESERVER}" - exec s6-setuidgid ${USERNAME} ./${GAMESERVER} stop + exec gosu ${USERNAME} ./${GAMESERVER} stop exitcode=$? exit ${exitcode} } @@ -53,4 +53,4 @@ chown -R ${USERNAME}:${USERNAME} /linuxgsm echo -e "" echo -e "Switch to user ${USERNAME}" echo -e "=================================" -exec s6-setuidgid ${USERNAME} /linuxgsm/entrypoint-user.sh +exec gosu ${USERNAME} /linuxgsm/entrypoint-user.sh