mirror of
				https://github.com/factoriotools/factorio-docker.git
				synced 2025-10-31 17:08:08 +01:00 
			
		
		
		
	* feat: Add rootless Docker support Implements #547 - Add support for rootless Docker images to avoid permission issues. Key changes: - Add Dockerfile.rootless that runs as UID 1000 by default - Create simplified entrypoint script without chown operations - Add build-rootless.py to build rootless variants with -rootless suffix - Document rootless usage in README-ROOTLESS.md - Update main README with rootless section The rootless images eliminate common permission problems by: - Running as non-root from the start (USER 1000:1000) - Avoiding recursive chown operations that can cause race conditions - Using open permissions (777) on directories during build - Not supporting PUID/PGID environment variables This provides a cleaner solution for rootless Docker users and those experiencing permission issues with volumes. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * fix: Address linting issues in rootless Docker implementation - Add --no-install-recommends to apt-get install in Dockerfile - Consolidate consecutive RUN instructions in Dockerfile - Fix shellcheck warnings: quote variables and use -n instead of \! -z - These changes improve best practices without affecting functionality 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * feat: Add rootless image building to CI pipeline - Update docker-build.yml workflow to build rootless variants - Rootless images are built after regular images with -rootless suffix - Both use the same multi-architecture build process - Triggered automatically when buildinfo.json changes 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * refactor: Unify build system for regular and rootless images - Create build-unified.py that handles both regular and rootless builds - Convert build.py and build-rootless.py to wrapper scripts for backwards compatibility - Update CI workflow to use unified build command - Add BUILD_MIGRATION.md documentation - Eliminate code duplication between build scripts - Support flexible build options: --rootless, --both, --only-stable-latest This maintains all existing functionality while providing a cleaner, more maintainable build system. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * chore: Add Python cache to .gitignore and remove from repo - Add __pycache__/ and Python compiled files to .gitignore - Remove accidentally committed __pycache__ directory - Prevent future Python cache files from being tracked 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * refactor: Replace build system with unified solution - Remove old build.py and build-rootless.py wrapper scripts - Rename build-unified.py to build.py as the main build script - Delete BUILD_MIGRATION.md (no longer needed) - Update CI workflow to use new build.py syntax - Update documentation in CLAUDE.md and README-ROOTLESS.md The new build system provides all functionality in a single script: - Default: builds regular images - --rootless: builds only rootless images - --both: builds both regular and rootless images - --multiarch and --push-tags: work as before This creates a cleaner, more maintainable build system. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * docs: Consolidate rootless documentation and mark as experimental - Remove separate README-ROOTLESS.md file - Integrate rootless documentation into main README.md - Mark rootless support as experimental - Add clear documentation about limitations and use cases - Include warning about experimental nature This consolidates all documentation in one place and makes it clear that rootless support is still experimental. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
		
			
				
	
	
		
			91 lines
		
	
	
		
			3.0 KiB
		
	
	
	
		
			Docker
		
	
	
	
	
	
			
		
		
	
	
			91 lines
		
	
	
		
			3.0 KiB
		
	
	
	
		
			Docker
		
	
	
	
	
	
| # build rcon client
 | |
| FROM debian:stable-slim AS rcon-builder
 | |
| RUN apt-get -q update \
 | |
|     && DEBIAN_FRONTEND=noninteractive apt-get -qy install build-essential --no-install-recommends
 | |
| 
 | |
| WORKDIR /src
 | |
| COPY rcon/ /src
 | |
| RUN make
 | |
| 
 | |
| # build factorio image
 | |
| FROM debian:stable-slim
 | |
| LABEL maintainer="https://github.com/factoriotools/factorio-docker"
 | |
| 
 | |
| ARG BOX64_VERSION=v0.2.4
 | |
| 
 | |
| # optionally utilize a built-in map-gen-preset (see data/base/prototypes/map-gen-presets
 | |
| ARG PRESET
 | |
| 
 | |
| # number of retries that curl will use when pulling the headless server tarball
 | |
| ARG CURL_RETRIES=8
 | |
| 
 | |
| ENV PORT=34197 \
 | |
|     RCON_PORT=27015 \
 | |
|     SAVES=/factorio/saves \
 | |
|     PRESET="$PRESET" \
 | |
|     CONFIG=/factorio/config \
 | |
|     MODS=/factorio/mods \
 | |
|     SCENARIOS=/factorio/scenarios \
 | |
|     SCRIPTOUTPUT=/factorio/script-output \
 | |
|     DLC_SPACE_AGE="true"
 | |
| 
 | |
| SHELL ["/bin/bash", "-eo", "pipefail", "-c"]
 | |
| 
 | |
| RUN apt-get -q update \
 | |
|     && DEBIAN_FRONTEND=noninteractive apt-get -qy install ca-certificates curl jq pwgen xz-utils procps gettext-base --no-install-recommends \
 | |
|     && if [[ "$(uname -m)" == "aarch64" ]]; then \
 | |
|         echo "installing ARM compatability layer" \
 | |
|         && DEBIAN_FRONTEND=noninteractive apt-get -qy install unzip --no-install-recommends \ 
 | |
|         && curl -LO https://github.com/ptitSeb/box64/releases/download/${BOX64_VERSION}/box64-GENERIC_ARM-RelWithDebInfo.zip \
 | |
|         && unzip box64-GENERIC_ARM-RelWithDebInfo.zip -d /bin \
 | |
|         && rm -f box64-GENERIC_ARM-RelWithDebInfo.zip \
 | |
|         && chmod +x /bin/box64; \
 | |
|     fi \
 | |
|     && rm -rf /var/lib/apt/lists/*
 | |
| 
 | |
| # version checksum of the archive to download
 | |
| ARG VERSION
 | |
| ARG SHA256
 | |
| 
 | |
| LABEL factorio.version=${VERSION}
 | |
| 
 | |
| ENV VERSION=${VERSION} \
 | |
|     SHA256=${SHA256}
 | |
| 
 | |
| RUN set -ox pipefail \
 | |
|     && if [[ "${VERSION}" == "" ]]; then \
 | |
|         echo "build-arg VERSION is required" \
 | |
|         && exit 1; \
 | |
|     fi \
 | |
|     && if [[ "${SHA256}" == "" ]]; then \
 | |
|         echo "build-arg SHA256 is required" \
 | |
|         && exit 1; \
 | |
|     fi \
 | |
|     && archive="/tmp/factorio_headless_x64_$VERSION.tar.xz" \
 | |
|     && mkdir -p /opt /factorio \
 | |
|     && curl -sSL "https://www.factorio.com/get-download/$VERSION/headless/linux64" -o "$archive" --retry $CURL_RETRIES \
 | |
|     && echo "$SHA256  $archive" | sha256sum -c \
 | |
|     || (sha256sum "$archive" && file "$archive" && exit 1) \
 | |
|     && tar xf "$archive" --directory /opt \
 | |
|     && chmod ugo=rwx /opt/factorio \
 | |
|     && rm "$archive" \
 | |
|     && ln -s "$SCENARIOS" /opt/factorio/scenarios \
 | |
|     && ln -s "$SAVES" /opt/factorio/saves \
 | |
|     && mkdir -p /opt/factorio/config/
 | |
| 
 | |
| COPY files/*.sh /
 | |
| COPY files/docker-entrypoint-rootless.sh /docker-entrypoint.sh
 | |
| COPY files/config.ini /opt/factorio/config/config.ini
 | |
| COPY --from=rcon-builder /src/rcon /bin/rcon
 | |
| 
 | |
| # Make all scripts executable and set proper permissions for the factorio directory
 | |
| RUN chmod +x /*.sh \
 | |
|     && chmod -R 777 /opt/factorio /factorio
 | |
| 
 | |
| VOLUME /factorio
 | |
| EXPOSE $PORT/udp $RCON_PORT/tcp
 | |
| 
 | |
| # Run as non-root user (UID 1000 is common for the first user in rootless containers)
 | |
| USER 1000:1000
 | |
| 
 | |
| ENTRYPOINT ["/docker-entrypoint.sh"] |