@@ -16,19 +16,11 @@ ARG BOX64_VERSION=v0.2.4
16
16
# space-exploration
17
17
ARG PRESET
18
18
19
- # version checksum of the archive to download
20
- ARG VERSION
21
- ARG SHA256
22
-
23
- LABEL factorio.version=${VERSION}
24
-
25
19
# number of retries that curl will use when pulling the headless server tarball
26
20
ARG CURL_RETRIES=8
27
21
28
22
ENV PORT=34197 \
29
23
RCON_PORT=27015 \
30
- VERSION=${VERSION} \
31
- SHA256=${SHA256} \
32
24
SAVES=/factorio/saves \
33
25
PRESET="$PRESET" \
34
26
CONFIG=/factorio/config \
@@ -39,6 +31,31 @@ ENV PORT=34197 \
39
31
PGID="$PGID"
40
32
41
33
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
+
42
59
RUN set -ox pipefail \
43
60
&& if [[ "${VERSION}" == "" ]]; then \
44
61
echo "build-arg VERSION is required" \
@@ -50,28 +67,15 @@ RUN set -ox pipefail \
50
67
fi \
51
68
&& archive="/tmp/factorio_headless_x64_$VERSION.tar.xz" \
52
69
&& 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 \
56
71
&& echo "$SHA256 $archive" | sha256sum -c \
57
72
|| (sha256sum "$archive" && file "$archive" && exit 1) \
58
73
&& tar xf "$archive" --directory /opt \
59
74
&& chmod ugo=rwx /opt/factorio \
60
75
&& 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/* \
70
76
&& ln -s "$SCENARIOS" /opt/factorio/scenarios \
71
77
&& ln -s "$SAVES" /opt/factorio/saves \
72
78
&& 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" \
75
79
&& chown -R "$USER" :"$GROUP" /opt/factorio /factorio
76
80
77
81
COPY files/*.sh /
0 commit comments