Skip to content

Commit c269289

Browse files
authored
Improve image stages (#509)
Signed-off-by: Marc 'risson' Schmitt <[email protected]>
1 parent ee0388e commit c269289

File tree

1 file changed

+26
-22
lines changed

1 file changed

+26
-22
lines changed

docker/Dockerfile

+26-22
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,11 @@ ARG BOX64_VERSION=v0.2.4
1616
# space-exploration
1717
ARG PRESET
1818

19-
# version checksum of the archive to download
20-
ARG VERSION
21-
ARG SHA256
22-
23-
LABEL factorio.version=${VERSION}
24-
2519
# number of retries that curl will use when pulling the headless server tarball
2620
ARG CURL_RETRIES=8
2721

2822
ENV PORT=34197 \
2923
RCON_PORT=27015 \
30-
VERSION=${VERSION} \
31-
SHA256=${SHA256} \
3224
SAVES=/factorio/saves \
3325
PRESET="$PRESET" \
3426
CONFIG=/factorio/config \
@@ -39,6 +31,31 @@ ENV PORT=34197 \
3931
PGID="$PGID"
4032

4133
SHELL ["/bin/bash", "-eo", "pipefail", "-c"]
34+
35+
RUN apt-get -q update \
36+
&& DEBIAN_FRONTEND=noninteractive apt-get -qy install ca-certificates curl jq pwgen xz-utils procps gettext-base --no-install-recommends \
37+
&& if [[ "$(uname -m)" == "aarch64" ]]; then \
38+
echo "installing ARM compatability layer" \
39+
&& DEBIAN_FRONTEND=noninteractive apt-get -qy install unzip --no-install-recommends \
40+
&& curl -LO https://github.com/ptitSeb/box64/releases/download/${BOX64_VERSION}/box64-GENERIC_ARM-RelWithDebInfo.zip \
41+
&& unzip box64-GENERIC_ARM-RelWithDebInfo.zip -d /bin \
42+
&& rm -f box64-GENERIC_ARM-RelWithDebInfo.zip \
43+
&& chmod +x /bin/box64; \
44+
fi \
45+
&& rm -rf /var/lib/apt/lists/*
46+
47+
RUN addgroup --system --gid "$PGID" "$GROUP" \
48+
&& adduser --system --uid "$PUID" --gid "$PGID" --no-create-home --disabled-password --shell /bin/sh "$USER"
49+
50+
# version checksum of the archive to download
51+
ARG VERSION
52+
ARG SHA256
53+
54+
LABEL factorio.version=${VERSION}
55+
56+
ENV VERSION=${VERSION} \
57+
SHA256=${SHA256}
58+
4259
RUN set -ox pipefail \
4360
&& if [[ "${VERSION}" == "" ]]; then \
4461
echo "build-arg VERSION is required" \
@@ -50,28 +67,15 @@ RUN set -ox pipefail \
5067
fi \
5168
&& archive="/tmp/factorio_headless_x64_$VERSION.tar.xz" \
5269
&& mkdir -p /opt /factorio \
53-
&& apt-get -q update \
54-
&& DEBIAN_FRONTEND=noninteractive apt-get -qy install ca-certificates curl jq pwgen xz-utils procps gettext-base --no-install-recommends \
55-
&& curl -sSL "https://www.factorio.com/get-download/$VERSION/headless/linux64" -o "$archive" --retry $CURL_RETRIES\
70+
&& curl -sSL "https://www.factorio.com/get-download/$VERSION/headless/linux64" -o "$archive" --retry $CURL_RETRIES \
5671
&& echo "$SHA256 $archive" | sha256sum -c \
5772
|| (sha256sum "$archive" && file "$archive" && exit 1) \
5873
&& tar xf "$archive" --directory /opt \
5974
&& chmod ugo=rwx /opt/factorio \
6075
&& rm "$archive" \
61-
&& if [[ "$(uname -m)" == "aarch64" ]]; then \
62-
echo "installing ARM compatability layer" \
63-
&& DEBIAN_FRONTEND=noninteractive apt-get -qy install unzip --no-install-recommends \
64-
&& curl -LO https://github.com/ptitSeb/box64/releases/download/${BOX64_VERSION}/box64-GENERIC_ARM-RelWithDebInfo.zip \
65-
&& unzip box64-GENERIC_ARM-RelWithDebInfo.zip -d /bin \
66-
&& rm -f box64-GENERIC_ARM-RelWithDebInfo.zip \
67-
&& chmod +x /bin/box64; \
68-
fi \
69-
&& rm -rf /var/lib/apt/lists/* \
7076
&& ln -s "$SCENARIOS" /opt/factorio/scenarios \
7177
&& ln -s "$SAVES" /opt/factorio/saves \
7278
&& mkdir -p /opt/factorio/config/ \
73-
&& addgroup --system --gid "$PGID" "$GROUP" \
74-
&& adduser --system --uid "$PUID" --gid "$PGID" --no-create-home --disabled-password --shell /bin/sh "$USER" \
7579
&& chown -R "$USER":"$GROUP" /opt/factorio /factorio
7680

7781
COPY files/*.sh /

0 commit comments

Comments
 (0)