Skip to content

Commit

Permalink
Swap to Debian slim baseimage (#469)
Browse files Browse the repository at this point in the history
* Swap to Debian slim baseimage

Co-authored-by: Sandro <[email protected]>

* Only install necessary packages

---------

Co-authored-by: Doridian <[email protected]>
Co-authored-by: Sandro <[email protected]>
  • Loading branch information
3 people authored Mar 3, 2024
1 parent afde972 commit bd76f1c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM frolvlad/alpine-glibc:alpine-3.12
FROM debian:stable-slim

LABEL maintainer="https://github.com/factoriotools/factorio-docker"

Expand Down Expand Up @@ -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" \
Expand All @@ -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) \
Expand All @@ -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 /
Expand Down
2 changes: 1 addition & 1 deletion docker/files/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit bd76f1c

Please sign in to comment.