-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
62 lines (46 loc) · 1.84 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# Intermediate staging container
FROM debian:12-slim AS staging
ARG VERSION="2.0.28"
ARG SHA256="ea9937b6adc7a18e17a4e1e64992ec389407497b36e68280bb14fcdd4c884dd3"
ARG URL="https://www.factorio.com/get-download/${VERSION}/headless/linux64"
# Create staging directory
RUN mkdir -p /staging
# Install required dependencies for preparation
RUN apt-get update && apt-get install --no-install-recommends -y \
curl ca-certificates xz-utils && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && rm -rf /tmp/* && rm -rf /var/tmp/*
# Download, verify and extract headless server archive
RUN curl -L $URL -o /tmp/archive_${VERSION}.txz && \
echo "${SHA256} /tmp/archive_${VERSION}.txz" | sha256sum -c - && \
tar xvJf /tmp/archive_${VERSION}.txz -C /staging && \
rm -f /tmp/archive_${VERSION}.txz
# Runtime image
FROM debian:12-slim
LABEL maintainer="Alexandre Gauthier <[email protected]>" \
description="Factorio Server"
ENV FACTORIO_HOME=/opt/factorio
ENV FACTORIO_VOLUME=${FACTORIO_HOME}/volume
ENV FACTORIO_CONFIGDIR=${FACTORIO_VOLUME}/config
ENV FACTORIO_SAVESDIR=${FACTORIO_VOLUME}/saves
ENV FACTORIO_MODSDIR=${FACTORIO_VOLUME}/mods
ENV FACTORIO_PORT=34197
ENV FACTORIO_RCON_PORT=27015
# Create runtime directories
RUN mkdir -p /opt/factorio/volume && mkdir -p /opt/factorio/config
WORKDIR /opt/factorio
# Install runtime dependencies
RUN apt-get update && apt-get install --no-install-recommends -y \
pwgen && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && rm -rf /tmp/* && rm -rf /var/tmp/*
# Copy factorio binaries
COPY --from=staging /staging/factorio .
# Copy stock configuration for volume paths
COPY files/config.ini config/config.ini
# Copy wrapper script
COPY files/run.sh .
RUN chmod +x ./run.sh
VOLUME ${FACTORIO_VOLUME}
EXPOSE ${FACTORIO_PORT}/udp ${FACTORIO_RCON_PORT}/tcp
ENTRYPOINT [ "/opt/factorio/run.sh" ]