Skip to content

Instantly share code, notes, and snippets.

@SpComb
Last active April 2, 2020 15:24
Show Gist options
  • Save SpComb/7f4b48b925c13dedda167543d6e956fb to your computer and use it in GitHub Desktop.
Save SpComb/7f4b48b925c13dedda167543d6e956fb to your computer and use it in GitHub Desktop.
docker build -t factorio .
docker run --rm -it --name=factorio --net=host -v /srv/factorio:/var/lib/factorio factorio:latest --help
docker run --rm -it --name=factorio --net=host -v /srv/factorio:/var/lib/factorio factorio:latest --create test.zip
docker run --rm -it --name=factorio --net=host -v /srv/factorio:/var/lib/factorio factorio:latest --start-server test.zip --server-settings server-settings.json
config-path=/opt/factorio/config
#This value specifies the way the aplication generates default values for path.read-data and path.write-data
#When set to true, it will use system directories (Users/Name/AppData/Roaming/Factorio on windows), this is set to true
#for the installer versions of Factorio, as people will usualy install it in program files, and the aplication can't write
#to program files by default (without UAC turned off), similar with osx/linux packages.
#When set to false (default value for zip package), it will use application root directory, this is usable to create self-sustainable
#Factorio directory that can be copied anywhere needed (on usb etc), also for people, who don't like to manipulate saves
#in the windows users directory structure (as me, kovarex).
#Note, that once the values in config are generated, this value has no effects (unless you delete config, or the path.read-data/path.write-data values)
use-system-read-write-data-directories=false
[path]
read-data=/opt/factorio/data
write-data=/var/lib/factorio
FROM debian:stretch
ARG FACTORIO_VERSION=0.16.51
RUN apt-get update && apt-get install -y \
curl xz-utils
RUN \
curl -fsSL https://www.factorio.com/get-download/$FACTORIO_VERSION/headless/linux64 -o /tmp/factorio-$FACTORIO_VERSION.tar.xz && \
tar -C /opt -xvf /tmp/factorio-$FACTORIO_VERSION.tar.xz && \
mv /opt/factorio /opt/factorio-$FACTORIO_VERSION && ln -s factorio-$FACTORIO_VERSION /opt/factorio && \
rm /tmp/factorio-*.tar.xz
RUN addgroup --system --gid 112 factorio && adduser --system --home /var/lib/factorio --uid=112 --gid=112 factorio
COPY config-path.cfg /opt/factorio-$FACTORIO_VERSION/
COPY config.ini /opt/factorio-$FACTORIO_VERSION/config/
VOLUME /var/lib/factorio
ENV PATH=/opt/factorio-$FACTORIO_VERSION/bin/x64:$PATH
USER factorio
WORKDIR /var/lib/factorio
ENTRYPOINT ["factorio"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment