Swap to Debian slim baseimage (#469)

* Swap to Debian slim baseimage

Co-authored-by: Sandro <sandro.jaeckel@gmail.com>

* Only install necessary packages

---------

Co-authored-by: Doridian <git@doridian.net>
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
This commit is contained in:
StealthCT 2024-03-03 02:57:47 +00:00 committed by GitHub
parent afde97243d
commit bd76f1c541
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 6 deletions

View File

@ -1,4 +1,4 @@
FROM frolvlad/alpine-glibc:alpine-3.12
FROM debian:stable-slim
LABEL maintainer="https://github.com/factoriotools/factorio-docker"
@ -26,7 +26,7 @@ ENV PORT=34197 \
PUID="$PUID" \
PGID="$PGID"
SHELL ["/bin/ash", "-eo", "pipefail", "-c"]
SHELL ["/bin/bash", "-eo", "pipefail", "-c"]
RUN set -ox pipefail \
&& if [[ "${VERSION}" == "" ]]; then \
echo "build-arg VERSION is required" \
@ -38,7 +38,9 @@ RUN set -ox pipefail \
fi \
&& archive="/tmp/factorio_headless_x64_$VERSION.tar.xz" \
&& mkdir -p /opt /factorio \
&& apk add --update --no-cache --no-progress bash binutils curl file gettext jq libintl pwgen shadow su-exec \
&& apt-get -q update \
&& DEBIAN_FRONTEND=noninteractive apt-get -qy install ca-certificates curl jq pwgen xz-utils --no-install-recommends \
&& rm -rf /var/lib/apt/lists/* \
&& curl -sSL "https://www.factorio.com/get-download/$VERSION/headless/linux64" -o "$archive" --retry $CURL_RETRIES\
&& echo "$SHA256 $archive" | sha256sum -c \
|| (sha256sum "$archive" && file "$archive" && exit 1) \
@ -48,8 +50,8 @@ RUN set -ox pipefail \
&& ln -s "$SCENARIOS" /opt/factorio/scenarios \
&& ln -s "$SAVES" /opt/factorio/saves \
&& mkdir -p /opt/factorio/config/ \
&& addgroup -g "$PGID" -S "$GROUP" \
&& adduser -u "$PUID" -G "$GROUP" -s /bin/sh -SDH "$USER" \
&& addgroup --system --gid "$PGID" "$GROUP" \
&& adduser --system --uid "$PUID" --gid "$PGID" --no-create-home --disabled-password --shell /bin/sh "$USER" \
&& chown -R "$USER":"$GROUP" /opt/factorio /factorio
COPY files/*.sh /

View File

@ -50,7 +50,7 @@ if [[ $(id -u) = 0 ]]; then
# Take ownership of factorio data if running as root
chown -R factorio:factorio "$FACTORIO_VOL"
# Drop to the factorio user
SU_EXEC="su-exec factorio"
SU_EXEC="runuser -u factorio -g factorio --"
else
SU_EXEC=""
fi