factorio-docker

module
v0.0.0-...-0c5ecab Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 20, 2025 License: AGPL-3.0

README

factorio-docker

Docker container for running Factorio.

Features

Quickstart

Docker CLI
# Create the storage directory for the server files and ensure it's
# owned by the container user.
# - data is for your server data
# - server_files is for the downloaded server only
sudo mkdir -p /opt/factorio{data,server_files}
sudo chown 845:845 /opt/factorio

docker run -d \
  -p 34197:34197/udp \
  -p 27015:27015/tcp \
  -v /opt/factorio/server_files:/opt/factorio \
  -v /opt/factorio/data:/data \
  -e VERSION=stable \
  --name factorio \
  --restart=unless-stopped \
  ghcr.io/jaredallard/factorio
docker compose
services:
  factorio:
    image: ghcr.io/jaredallard/factorio
    restart: unless-stopped
    environment:
      # Version can be: experimental, stable, or a specific version.
      VERSION: stable
      # Optional: Checksum to expect for the downloaded tar.xz. If not
      # set, it will be fetched from Factorio's site.
      SHA256SUM: ""
    ports:
      - 34197:34197/udp
      - 27015:27015/tcp
    volumes:
      - data:/data
      - server_files:/opt/factorio

volumes:
  data:
  server_files:

Note: Alternatively, you can remove the top-level volumes key and replace data: with a path on your host machine. For more information about Docker volumes, see the docs.

Versions

To see the available versions, check out the Github Packages UI for this repository.

Development

Prerequisites:

  • mise (One can try to use host Go, but some scripts may not work without mise being installed)

First time/after-pulling:

mise install

Building:

mise run build

FAQ

Why not factoriotools/factorio-docker?

I don't have an amazing reason other than I building on top of that image originally and found that using Bash was hitting it's limits pretty quickly for adding support for things like Factocord. I'd prefer to use Go to implement that, but upstream was Python and I didn't have a ton of interest in using Python (sorry!). I also really believe that all Docker images should be attested thanks to how easy Github has made it, but their images are built with a Python script that sadly can't easily do this :(

How do I verify the Docker image?

You can use the Github CLI to easily verify that it was created through a Github action at a given commit. For example, to verify the latest built image:

docker pull ghcr.io/jaredallard/factorio
# --deny-self-hosted-runners is optional, but proves that I didn't run
# my own runners to create this image and somehow 'taint' the process.
gh attestation verify oci://ghcr.io/jaredallard/factorio \
  --owner jaredallard --deny-self-hosted-runners

Differences between factoriotools/factorio-docker

  1. Docker images do NOT contain Factorio's server code. a) Why not? While it was considered to do this, it was decided to not because that would leave the base docker images vulnerable as they would likely rarely be updated. As such, it was decided that the version should always be downloaded at runtime once instead.

License

AGPL-3.0

Directories

Path Synopsis
cmd
downloader
Package main implements the downloader CLI.
Package main implements the downloader CLI.
wrapper
Package main implements the wrapper CLI.
Package main implements the wrapper CLI.
internal
config
Package config stores configuration for wrapping and configuring Factorio.
Package config stores configuration for wrapping and configuring Factorio.
downloader
Package downloader implements a high-level interface for downloading a Factorio server and installing it.
Package downloader implements a high-level interface for downloading a Factorio server and installing it.
factorio
Package factorio contains helpers for interacting with factorio.com and the Factorio game.
Package factorio contains helpers for interacting with factorio.com and the Factorio game.
launcher
Package launcher runs Factorio or wrappers, such as Factocord.
Package launcher runs Factorio or wrappers, such as Factocord.
state
Package state handles tracking the state of the Factorio server.
Package state handles tracking the state of the Factorio server.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL