mirror of
				https://github.com/factoriotools/factorio-docker.git
				synced 2025-10-26 14:41:55 +01:00 
			
		
		
		
	Compare commits
	
		
			378 Commits
		
	
	
		
			0.18.32-1
			...
			b20d93e229
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | b20d93e229 | ||
|  | 9562212254 | ||
|  | 6060c7b722 | ||
|  | 06baf6a186 | ||
|  | 6eb0cd96d8 | ||
|  | bbbfef343c | ||
|  | 44a58b056c | ||
|  | e37bcf1ed0 | ||
|  | 3defd74c46 | ||
|  | dde2761a8c | ||
|  | 0ec91c3391 | ||
|  | f9040c7450 | ||
|  | c9957b7d76 | ||
|  | 89ae20012e | ||
|  | d137f32c2f | ||
|  | 4f3c5f2e93 | ||
|  | f7e9dea263 | ||
|  | 748dec4ad5 | ||
|  | 3ce89a714b | ||
|  | a8ecb01f4c | ||
|  | 6692bb514d | ||
|  | 2d805feb4f | ||
|  | bc2dc44cad | ||
|  | 04085ef23d | ||
|  | fbb787e535 | ||
|  | 2ba59b4f95 | ||
|  | c269289a96 | ||
|  | ee0388e163 | ||
|  | a1cb15b709 | ||
|  | 890489fb15 | ||
|  | c756ffe827 | ||
|  | 4474b52473 | ||
|  | 84a808102f | ||
|  | 016c5cf3b5 | ||
|  | 159b14bd8e | ||
|  | c1b0f6ca83 | ||
|  | 965fef7ac2 | ||
|  | 88fed07073 | ||
|  | 4ab4c889f4 | ||
|  | bc28f4a917 | ||
|  | d792589c56 | ||
|  | 486c0f1d0a | ||
|  | 80d8761520 | ||
|  | f4e0e640c5 | ||
|  | 51b601b8b6 | ||
|  | 1d88d18b38 | ||
|  | 7d085d7fe5 | ||
|  | 630c5a1864 | ||
|  | 98d3e475d3 | ||
|  | bd76f1c541 | ||
|  | afde97243d | ||
|  | 81b476ac97 | ||
|  | 30e56a197c | ||
|  | effd07f84c | ||
|  | 23d40f36de | ||
|  | 250a90de53 | ||
|  | 89f601e5ce | ||
|  | 73fe111bea | ||
|  | 18b455ba43 | ||
|  | 1c5e98f289 | ||
|  | 0a3d923c5b | ||
|  | 19f52a6ce0 | ||
|  | f6461d99be | ||
|  | f5a9224756 | ||
|  | 79eebfb0f9 | ||
|  | b75bce7f91 | ||
|  | ef449c4763 | ||
|  | 42c2d0f0b9 | ||
|  | e2f732a61c | ||
|  | d53f7900d8 | ||
|  | abf3166142 | ||
|  | f255b89a5e | ||
|  | fd717ee1b1 | ||
|  | 551b748297 | ||
|  | 87403fdb1b | ||
|  | 882ad42893 | ||
|  | f9c256e0e4 | ||
|  | 8f0e42ec25 | ||
|  | 6b92576644 | ||
|  | 2f51b1ae60 | ||
|  | 21fbb3f294 | ||
|  | d5e3f1580b | ||
|  | e3c1e34fe7 | ||
|  | 0fc0e18cb0 | ||
|  | d634a84e0f | ||
|  | ba5670692e | ||
|  | ceea4e5dcb | ||
|  | 0f5d60d61c | ||
|  | 9171b1fd5d | ||
|  | ced1340b11 | ||
|  | d7e6952db8 | ||
|  | 24218ec31a | ||
|  | 5491f01acb | ||
|  | 3e8c2f5cb7 | ||
|  | d306b82fbe | ||
|  | bd1ba3cf9d | ||
|  | dfd442dfda | ||
|  | f262181b4e | ||
|  | f7282c516c | ||
|  | 4fe8b3d0bd | ||
|  | 69e7d8ee55 | ||
|  | d90480712d | ||
|  | d74b635be5 | ||
|  | 0b5695e55a | ||
|  | 34bf552c2c | ||
|  | bd048b90e2 | ||
|  | 771eb142f0 | ||
|  | 492b0378a3 | ||
|  | 2ac5f259fa | ||
|  | 5bf1b045e1 | ||
|  | b09c5ab001 | ||
|  | c6bf7fef1d | ||
|  | 626351232a | ||
|  | db41eaad31 | ||
|  | 02695f0f00 | ||
|  | 5aef1b9f6f | ||
|  | 2f28ee6626 | ||
|  | 9912dbd9bb | ||
|  | 420fecc788 | ||
|  | 67bea4df99 | ||
|  | b12e652e4d | ||
|  | d0cfb691ec | ||
|  | 88757eb5d1 | ||
|  | e365e2cd5e | ||
|  | d7db07e265 | ||
|  | e5aac5fc9e | ||
|  | 0f969e517a | ||
|  | 96d38bc3e8 | ||
|  | 4e43fdd73b | ||
|  | b20ff166e7 | ||
|  | e0165b4b2d | ||
|  | bbfbb86308 | ||
|  | 0aae38e6a0 | ||
|  | 991d3e2765 | ||
|  | e4ce42d9f3 | ||
|  | 157f9484db | ||
|  | a8326cd88a | ||
|  | 1ebd9ced8d | ||
|  | 723160de54 | ||
|  | cc96cf2294 | ||
|  | 79e22b8db5 | ||
|  | 5a03444010 | ||
|  | 43ce3dc8e1 | ||
|  | 97e1433fde | ||
|  | f6aec0a546 | ||
|  | 039a8626ba | ||
|  | 634e7267a9 | ||
|  | d1e5ac742e | ||
|  | 9eec6b9dd5 | ||
|  | c8b079caf0 | ||
|  | bce3ff95ba | ||
|  | faa84dbfa6 | ||
|  | 8003142235 | ||
|  | 9863a4cd74 | ||
|  | c5d668ac09 | ||
|  | 87a4ba87e5 | ||
|  | 9bdbd90322 | ||
|  | 4812b5b970 | ||
|  | 65e3f84c4f | ||
|  | 02cc66c3ba | ||
|  | c09257d28a | ||
|  | 769617edc4 | ||
|  | d6154359d9 | ||
|  | 765d2bb23d | ||
|  | 50d60680e0 | ||
|  | 0d5f77f0da | ||
|  | 0a56912cfd | ||
|  | 136329f45e | ||
|  | f3dc109e7e | ||
|  | f84fee3624 | ||
|  | 118f149aee | ||
|  | 60165855ff | ||
|  | 89b9851edb | ||
|  | f2a5d6d075 | ||
|  | 5e018ca2ae | ||
|  | 0160889854 | ||
|  | bc9276737b | ||
|  | 5e3943362b | ||
|  | 3778d6bb66 | ||
|  | fbf430373d | ||
|  | a495ac72cd | ||
|  | 17e84504cf | ||
|  | cea55cda67 | ||
|  | b0ad3fa036 | ||
|  | 1a6e902c6b | ||
|  | dadf88d5e3 | ||
|  | b065ecb257 | ||
|  | f0b1ff342f | ||
|  | 9a563a35b8 | ||
|  | 75543ebbe6 | ||
|  | d17a6e648e | ||
|  | b96fb634b1 | ||
|  | 9248c57549 | ||
|  | 8641b6d34b | ||
|  | aefd5339c6 | ||
|  | 504aa3a05a | ||
|  | ccc7f5624a | ||
|  | 0336fbe3cf | ||
|  | 452aab7ffb | ||
|  | a953759b96 | ||
|  | f61abdc8b5 | ||
|  | bb4d2d0154 | ||
|  | f44f690b6a | ||
|  | eadada76b9 | ||
|  | 45eb323d17 | ||
|  | cad67f5d0b | ||
|  | 18fe336fb8 | ||
|  | a7c9b3e1c8 | ||
|  | 2026cce01a | ||
|  | 7b7f47f464 | ||
|  | 1f83234834 | ||
|  | bc06b94f38 | ||
|  | 3abd2d69fc | ||
|  | 63fc1066dc | ||
|  | 7f4e005b1a | ||
|  | 5222d392b1 | ||
|  | be8c1b28a3 | ||
|  | e5a70d4ada | ||
|  | 31448a0c06 | ||
|  | 6d2fcd5696 | ||
|  | 65b909310c | ||
|  | e8fca26f7a | ||
|  | 6ce248eacb | ||
|  | a683f67f86 | ||
|  | b253a086cc | ||
|  | 36ecbb3de8 | ||
|  | 3bd6929ee7 | ||
|  | cb4f36fc91 | ||
|  | 06433d2ba1 | ||
|  | 31a0c78ba6 | ||
|  | 29f5222c35 | ||
|  | 13ebf33867 | ||
|  | 3947458623 | ||
|  | cb6eb6e519 | ||
|  | 9896b03e0a | ||
|  | 5176be56db | ||
|  | 72fdb9fc42 | ||
|  | b0b62d5ba7 | ||
|  | 4f73862221 | ||
|  | 5b83699e5c | ||
|  | 511520c459 | ||
|  | 99db93d6f8 | ||
|  | 24825309c3 | ||
|  | db25aab203 | ||
|  | d10ec1e309 | ||
|  | 14851be061 | ||
|  | 1212e00fa3 | ||
|  | c537410871 | ||
|  | 068b96ae2b | ||
|  | 9c3ec3c817 | ||
|  | 229f3d7fda | ||
|  | 248dab3db1 | ||
|  | c25e2c8a1d | ||
|  | 4a84743920 | ||
|  | cc4f8b192d | ||
|  | acd9c559fb | ||
|  | ff7074822b | ||
|  | 99100f8495 | ||
|  | 939827eb81 | ||
|  | 7c1406b38c | ||
|  | 5f7a32e492 | ||
|  | a11cbbbf41 | ||
|  | dac8e07016 | ||
|  | 63fcb292a8 | ||
|  | 2a313aa6d6 | ||
|  | b5a6059386 | ||
|  | 5904849dbc | ||
|  | 1987d7b43a | ||
|  | 54b1a97074 | ||
|  | ec1aef13d6 | ||
|  | bc9ec68e87 | ||
|  | 51762ba589 | ||
|  | dffc09f0ff | ||
|  | cc7f772024 | ||
|  | cef0016bf4 | ||
|  | 5b5a658116 | ||
|  | 3e3dfb7c05 | ||
|  | e150272201 | ||
|  | 228cc517e0 | ||
|  | 850bb9aef0 | ||
|  | caafc2cbef | ||
|  | 3f3fa0a008 | ||
|  | af51b87df7 | ||
|  | 78b45f2cca | ||
|  | 257229118f | ||
|  | 6aadd6053a | ||
|  | db54b89dae | ||
|  | 64cad3e345 | ||
|  | c88e79fd5b | ||
|  | d0610c47d6 | ||
|  | 851507c3ef | ||
|  | 3e5afe32ab | ||
|  | 2359a1c5d8 | ||
|  | d99ef45240 | ||
|  | 2b26cd1b69 | ||
|  | 7dddaf62bd | ||
|  | 3f034d0754 | ||
|  | 7720e32081 | ||
|  | 65049c8120 | ||
|  | c94ab998b4 | ||
|  | 6e4ec92a95 | ||
|  | 7dcac4cdd7 | ||
|  | cc70895c33 | ||
|  | 89b54579e0 | ||
|  | c1e1a1c4ca | ||
|  | 429c88f290 | ||
|  | 074bf11633 | ||
|  | 5765088f7e | ||
|  | 316f790530 | ||
|  | c91852a196 | ||
|  | 9ba7c5c8d6 | ||
|  | f2a4223c7b | ||
|  | 2a5e5b48ef | ||
|  | 57e979bca1 | ||
|  | 88ca3293a6 | ||
|  | 018269377a | ||
|  | 846e102ac8 | ||
|  | 4551f6ee03 | ||
|  | 09db1e2141 | ||
|  | cb9a9812bd | ||
|  | d03e4063e7 | ||
|  | 21c5c85ac3 | ||
|  | a10642d3eb | ||
|  | 2856c1cf76 | ||
|  | 3e736968d1 | ||
|  | ac6d647ddd | ||
|  | 02439750d1 | ||
|  | 3efae7b161 | ||
|  | 49a258c830 | ||
|  | 3ffa3610ef | ||
|  | 56984b2ef1 | ||
|  | 653c87a32e | ||
|  | 07bd20120c | ||
|  | bd7347b42c | ||
|  | cfbef2aedb | ||
|  | 8436dfe8a0 | ||
|  | 82892d8ad8 | ||
|  | 34132ddbd6 | ||
|  | b52af78919 | ||
|  | 13964c7a50 | ||
|  | e5e5dc27d2 | ||
|  | 8ad8f81eed | ||
|  | b0e855bb8a | ||
|  | 31a60e976b | ||
|  | c108d48f00 | ||
|  | fa741f635f | ||
|  | 5258ed7843 | ||
|  | d31d7f5ae6 | ||
|  | 0efbfb5c2d | ||
|  | 57f867aa80 | ||
|  | ded7d36fa8 | ||
|  | 93822d930c | ||
|  | 5474bb842d | ||
|  | ff432200f0 | ||
|  | 310214eb46 | ||
|  | bc3b08e470 | ||
|  | 1ef555ab24 | ||
|  | c8c6cb62ea | ||
|  | ac21591ee9 | ||
|  | bef01206d1 | ||
|  | a7131499e4 | ||
|  | 2a2092755c | ||
|  | 7d50408b87 | ||
|  | 9a7174ddaf | ||
|  | fffc38615f | ||
|  | 7b31cc044a | ||
|  | 0331df2774 | ||
|  | 1405a9be04 | ||
|  | b630de0efa | ||
|  | a2aec76419 | ||
|  | c112d3969f | ||
|  | 624c42a831 | ||
|  | 8c9adbbbc6 | ||
|  | e057dd5b22 | ||
|  | a5b2e042a9 | ||
|  | 9960cc856d | ||
|  | 1bb5f2610e | ||
|  | 8ee8fafe38 | 
							
								
								
									
										11
									
								
								.github/dependabot.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								.github/dependabot.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | ||||
| version: 2 | ||||
| updates: | ||||
|   - package-ecosystem: "github-actions" | ||||
|     directory: "/" | ||||
|     schedule: | ||||
|       interval: "daily" | ||||
|  | ||||
|   - package-ecosystem: docker | ||||
|     directory: "/docker" | ||||
|     schedule: | ||||
|       interval: "daily" | ||||
							
								
								
									
										29
									
								
								.github/workflows/docker-build.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								.github/workflows/docker-build.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,29 @@ | ||||
| name: Docker build & push | ||||
|  | ||||
| on: | ||||
|   push: | ||||
|     branches: | ||||
|       - master | ||||
|     paths: | ||||
|       - buildinfo.json | ||||
|   # workaround for #526 | ||||
|   workflow_dispatch: | ||||
|  | ||||
| jobs: | ||||
|   build: | ||||
|     runs-on: ubuntu-latest | ||||
|     steps: | ||||
|  | ||||
|       - name: Checkout | ||||
|         uses: actions/checkout@v4 | ||||
|  | ||||
|       - name: Set up QEMU | ||||
|         uses: docker/setup-qemu-action@v3 | ||||
|  | ||||
|       - name: build and push | ||||
|         if: ${{ env.DOCKER_USERNAME != '' && env.DOCKER_PASSWORD != '' }} | ||||
|         env: | ||||
|           DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | ||||
|           DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | ||||
|         run: | | ||||
|           ./build.py --push-tags --multiarch | ||||
							
								
								
									
										28
									
								
								.github/workflows/docker-description.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								.github/workflows/docker-description.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,28 @@ | ||||
| name: Docker Hub Description | ||||
|  | ||||
| on: | ||||
|   push: | ||||
|     branches: | ||||
|       - master | ||||
|     paths: | ||||
|       - README.md | ||||
|   # workaround for #526 | ||||
|   workflow_dispatch: | ||||
|  | ||||
| jobs: | ||||
|   docker-description: | ||||
|     runs-on: ubuntu-latest | ||||
|     steps: | ||||
|       - name: Checkout | ||||
|         uses: actions/checkout@v4 | ||||
|  | ||||
|       - name: Docker Hub Description | ||||
|         uses: peter-evans/dockerhub-description@v4.0.0 | ||||
|         if: ${{ env.DOCKER_USERNAME != '' && env.DOCKER_PASSWORD != '' }} | ||||
|         env: | ||||
|           DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | ||||
|           DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | ||||
|         with: | ||||
|           username: ${{ secrets.DOCKER_USERNAME }} | ||||
|           password: ${{ secrets.DOCKER_PASSWORD }} | ||||
|           repository: factoriotools/factorio | ||||
							
								
								
									
										32
									
								
								.github/workflows/lint.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								.github/workflows/lint.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,32 @@ | ||||
| name: 'Linter' | ||||
|  | ||||
| on: | ||||
|   pull_request: | ||||
|   push: | ||||
|     branches: | ||||
|       - master | ||||
|  | ||||
| jobs: | ||||
|   shellcheck: | ||||
|     runs-on: ubuntu-latest | ||||
|     steps: | ||||
|       - name: Checkout | ||||
|         uses: actions/checkout@v4 | ||||
|  | ||||
|       - name: shellcheck | ||||
|         uses: reviewdog/action-shellcheck@v1 | ||||
|         with: | ||||
|           github_token: ${{ secrets.github_token }} | ||||
|           reporter: github-pr-review | ||||
|  | ||||
|   hadolint: | ||||
|     runs-on: ubuntu-latest | ||||
|     steps: | ||||
|       - name: Checkout | ||||
|         uses: actions/checkout@v4 | ||||
|  | ||||
|       - name: hadolint | ||||
|         uses: reviewdog/action-hadolint@v1 | ||||
|         with: | ||||
|           github_token: ${{ secrets.github_token }} | ||||
|           reporter: github-pr-review | ||||
							
								
								
									
										19
									
								
								.github/workflows/update.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								.github/workflows/update.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,19 @@ | ||||
| name: Check Update | ||||
|  | ||||
| on: | ||||
|   schedule: | ||||
|     - cron: "0 * * * *" | ||||
|   workflow_dispatch: | ||||
|  | ||||
| jobs: | ||||
|   check: | ||||
|     runs-on: ubuntu-latest | ||||
|     if: github.event_name != 'schedule' || (github.event_name == 'schedule' && github.repository == 'factoriotools/factorio-docker') | ||||
|  | ||||
|     steps: | ||||
|       - name: Checkout | ||||
|         uses: actions/checkout@v4 | ||||
|  | ||||
|       - name: Run update script | ||||
|         run: ./update.sh | ||||
|         shell: bash | ||||
							
								
								
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,2 @@ | ||||
| # IDE | ||||
| .idea | ||||
							
								
								
									
										34
									
								
								.travis.yml
									
									
									
									
									
								
							
							
						
						
									
										34
									
								
								.travis.yml
									
									
									
									
									
								
							| @@ -1,34 +0,0 @@ | ||||
| dist: xenial | ||||
| language: bash | ||||
| services: | ||||
|   - docker | ||||
|  | ||||
| addons: | ||||
|   apt: | ||||
|     packages: | ||||
|     - jq | ||||
|  | ||||
| jobs: | ||||
|   include: | ||||
|     - stage: test | ||||
|       script: | ||||
|         - git ls-files --exclude='*Dockerfile' --ignored | xargs --max-lines=1 -I{} sh -c 'docker run --rm -i -v ${PWD}/.hadolint.yaml:/.hadolint.yaml hadolint/hadolint < "$1"' -- {} | ||||
|         - bash -c 'shopt -s globstar; shellcheck **/*.sh' | ||||
|  | ||||
|     - &build | ||||
|       stage: Build & update Docker HUB description | ||||
|       env: VERSION_SHORT=0.18 EXTRA_TAG=latest | ||||
|       script: | ||||
|         - ./build.sh $VERSION_SHORT | ||||
|     - <<: *build | ||||
|       env: VERSION_SHORT=0.17 EXTRA_TAG=stable | ||||
|     - <<: *build | ||||
|       env: VERSION_SHORT=0.16 | ||||
|     - <<: *build | ||||
|       env: VERSION_SHORT=0.15 | ||||
|     - <<: *build | ||||
|       env: VERSION_SHORT=0.14 | ||||
|     - <<: *build | ||||
|       if: branch = master AND type != pull_request | ||||
|       env: | ||||
|       script: DOCKERHUB_USERNAME=$DOCKER_USERNAME DOCKERHUB_PASSWORD=$DOCKER_PASSWORD DOCKERHUB_REPOSITORY='factoriotools/factorio' README_FILEPATH='./README.md' ./update-dockerhub-description.sh | ||||
| @@ -1,26 +0,0 @@ | ||||
| FROM frolvlad/alpine-glibc:alpine-3.11 | ||||
|  | ||||
| LABEL maintainer="https://github.com/factoriotools/factorio-docker" | ||||
|  | ||||
| ENV VERSION=0.14.23 \ | ||||
|     SHA1=6ef84341c6fc1cf45cfdd6acc8468aaa117b9e8a | ||||
|  | ||||
| RUN mkdir -p /opt \ | ||||
|     && apk --no-cache add curl tini pwgen \ | ||||
|     && curl -sSL https://www.factorio.com/get-download/$VERSION/headless/linux64 \ | ||||
|         -o /tmp/factorio_headless_x64_$VERSION.tar.gz \ | ||||
|     && echo "$SHA1  /tmp/factorio_headless_x64_$VERSION.tar.gz" | sha1sum -c \ | ||||
|     && tar xzf /tmp/factorio_headless_x64_$VERSION.tar.gz --directory /opt \ | ||||
|     && rm /tmp/factorio_headless_x64_$VERSION.tar.gz \ | ||||
|     && apk del curl \ | ||||
|     && ln -s /factorio/saves /opt/factorio/saves \ | ||||
|     && ln -s /factorio/mods /opt/factorio/mods | ||||
|  | ||||
| VOLUME /factorio | ||||
|  | ||||
| EXPOSE 34197/udp 27015/tcp | ||||
|  | ||||
| COPY ./docker-entrypoint.sh / | ||||
|  | ||||
| ENTRYPOINT ["/sbin/tini", "--"] | ||||
| CMD ["/docker-entrypoint.sh"] | ||||
| @@ -1,2 +0,0 @@ | ||||
| #!/bin/sh | ||||
| sudo docker build --no-cache -t factorio . | ||||
| @@ -1,2 +0,0 @@ | ||||
| #!/bin/sh | ||||
| sudo rm -rf /tmp/factorio | ||||
| @@ -1,35 +0,0 @@ | ||||
| #!/bin/sh -x | ||||
|  | ||||
| set -euo pipefail | ||||
|  | ||||
| SAVES=/factorio/saves | ||||
| CONFIG=/factorio/config | ||||
|  | ||||
| mkdir -p "$SAVES" | ||||
| mkdir -p /factorio/mods | ||||
| mkdir -p "$CONFIG" | ||||
|  | ||||
| if [ ! -f $CONFIG/rconpw ]; then | ||||
|   pwgen 15 1 >"$CONFIG/rconpw" | ||||
| fi | ||||
|  | ||||
| if [ ! -f "$CONFIG/server-settings.json" ]; then | ||||
|   cp /opt/factorio/data/server-settings.example.json "$CONFIG/server-settings.json" | ||||
| fi | ||||
|  | ||||
| if [ ! -f "$CONFIG/map-gen-settings.json" ]; then | ||||
|   cp /opt/factorio/data/map-gen-settings.example.json "$CONFIG/map-gen-settings.json" | ||||
| fi | ||||
|  | ||||
| if ! find -L "$SAVES" -iname \*.zip -mindepth 1 -print | grep -q .; then | ||||
|   /opt/factorio/bin/x64/factorio \ | ||||
|     --create "$SAVES/_autosave1.zip" \ | ||||
|     --map-gen-settings "$CONFIG/map-gen-settings.json" | ||||
| fi | ||||
|  | ||||
| exec /opt/factorio/bin/x64/factorio \ | ||||
|   --port 34197 \ | ||||
|   --start-server-load-latest \ | ||||
|   --server-settings "$CONFIG/server-settings.json" \ | ||||
|   --rcon-port 27015 \ | ||||
|   --rcon-password "$(cat "$CONFIG/rconpw")" | ||||
| @@ -1,6 +0,0 @@ | ||||
| #!/bin/sh | ||||
| sudo docker run --rm -it \ | ||||
| 	-v /tmp/factorio:/factorio \ | ||||
| 	--name factorio \ | ||||
| 	factorio "$@" | ||||
| find /tmp/factorio -type f | ||||
| @@ -1,30 +0,0 @@ | ||||
| FROM frolvlad/alpine-glibc:alpine-3.11 | ||||
|  | ||||
| LABEL maintainer="https://github.com/factoriotools/factorio-docker" | ||||
|  | ||||
| ENV PORT=34197 \ | ||||
|     RCON_PORT=27015 \ | ||||
|     VERSION=0.15.40 \ | ||||
|     SHA1=f79a975f6b8c0ee87e2fa60f7d1f7133f332c3ec | ||||
|  | ||||
| RUN mkdir -p /opt \ | ||||
|     && apk add --update --no-cache tini pwgen \ | ||||
|     && apk add --update --no-cache --virtual .build-deps curl \ | ||||
|     && curl -sSL https://www.factorio.com/get-download/$VERSION/headless/linux64 \ | ||||
|         -o /tmp/factorio_headless_x64_$VERSION.tar.xz \ | ||||
|     && echo "$SHA1  /tmp/factorio_headless_x64_$VERSION.tar.xz" | sha1sum -c \ | ||||
|     && tar xf /tmp/factorio_headless_x64_$VERSION.tar.xz --directory /opt \ | ||||
|     && chmod -R ugo=rwx /opt/factorio \ | ||||
|     && rm /tmp/factorio_headless_x64_$VERSION.tar.xz \ | ||||
|     && ln -s /factorio/saves /opt/factorio/saves \ | ||||
|     && ln -s /factorio/mods /opt/factorio/mods \ | ||||
|     && apk del .build-deps | ||||
|  | ||||
| VOLUME /factorio | ||||
|  | ||||
| EXPOSE $PORT/udp $RCON_PORT/tcp | ||||
|  | ||||
| COPY ./docker-entrypoint.sh / | ||||
|  | ||||
| ENTRYPOINT ["/sbin/tini", "--"] | ||||
| CMD ["/docker-entrypoint.sh"] | ||||
| @@ -1,8 +0,0 @@ | ||||
| version: '2' | ||||
| services: | ||||
|   factorio: | ||||
|     build: . | ||||
|     ports: | ||||
|      - "34197:34197" | ||||
|     volumes: | ||||
|      - /tmp/factorio:/factorio | ||||
| @@ -1,43 +0,0 @@ | ||||
| #!/bin/sh -x | ||||
|  | ||||
| set -euo pipefail | ||||
|  | ||||
| SAVES=/factorio/saves | ||||
| CONFIG=/factorio/config | ||||
|  | ||||
| mkdir -p "$SAVES" | ||||
| mkdir -p /factorio/mods | ||||
| mkdir -p "$CONFIG" | ||||
|  | ||||
| if [ ! -f "$CONFIG/rconpw" ]; then | ||||
|   pwgen 15 1 >"$CONFIG/rconpw" | ||||
| fi | ||||
|  | ||||
| if [ ! -f "$CONFIG/server-settings.json" ]; then | ||||
|   cp /opt/factorio/data/server-settings.example.json "$CONFIG/server-settings.json" | ||||
| fi | ||||
|  | ||||
| if [ ! -f "$CONFIG/map-gen-settings.json" ]; then | ||||
|   cp /opt/factorio/data/map-gen-settings.example.json "$CONFIG/map-gen-settings.json" | ||||
| fi | ||||
|  | ||||
| if [ ! -f "$CONFIG/map-settings.json" ]; then | ||||
|   cp /opt/factorio/data/map-settings.example.json "$CONFIG/map-settings.json" | ||||
| fi | ||||
|  | ||||
| if ! find -L "$SAVES" -iname \*.zip -mindepth 1 -print | grep -q .; then | ||||
|   /opt/factorio/bin/x64/factorio \ | ||||
|     --create "$SAVES/_autosave1.zip" \ | ||||
|     --map-gen-settings "$CONFIG/map-gen-settings.json" \ | ||||
|     --map-settings "$CONFIG/map-settings.json" | ||||
| fi | ||||
|  | ||||
| exec /opt/factorio/bin/x64/factorio \ | ||||
|   --port "$PORT" \ | ||||
|   --start-server-load-latest \ | ||||
|   --server-settings "$CONFIG/server-settings.json" \ | ||||
|   --server-whitelist "$CONFIG/server-whitelist.json" \ | ||||
|   --server-banlist "$CONFIG/server-banlist.json" \ | ||||
|   --rcon-port "$RCON_PORT" \ | ||||
|   --rcon-password "$(cat "$CONFIG/rconpw")" \ | ||||
|   --server-id /factorio/config/server-id.json | ||||
| @@ -1,46 +0,0 @@ | ||||
| FROM frolvlad/alpine-glibc:alpine-3.11 | ||||
|  | ||||
| LABEL maintainer="https://github.com/factoriotools/factorio-docker" | ||||
|  | ||||
| ARG USER=factorio | ||||
| ARG GROUP=factorio | ||||
| ARG PUID=845 | ||||
| ARG PGID=845 | ||||
|  | ||||
| ENV PORT=34197 \ | ||||
|     RCON_PORT=27015 \ | ||||
|     VERSION=0.16.51 \ | ||||
|     SHA1=127e7ff484ab263b13615d6114013ce0a66ac929 \ | ||||
|     SAVES=/factorio/saves \ | ||||
|     CONFIG=/factorio/config \ | ||||
|     MODS=/factorio/mods \ | ||||
|     SCENARIOS=/factorio/scenarios \ | ||||
|     SCRIPTOUTPUT=/factorio/script-output \ | ||||
|     PUID="$PUID" \ | ||||
|     PGID="$PGID" | ||||
|  | ||||
| RUN mkdir -p /opt /factorio \ | ||||
|     && apk add --update --no-cache pwgen su-exec shadow \ | ||||
|     && apk add --update --no-cache --virtual .build-deps curl \ | ||||
|     && curl -sSL https://www.factorio.com/get-download/$VERSION/headless/linux64 \ | ||||
|         -o /tmp/factorio_headless_x64_$VERSION.tar.xz \ | ||||
|     && echo "$SHA1  /tmp/factorio_headless_x64_$VERSION.tar.xz" | sha1sum -c \ | ||||
|     && tar xf /tmp/factorio_headless_x64_$VERSION.tar.xz --directory /opt \ | ||||
|     && chmod ugo=rwx /opt/factorio \ | ||||
|     && rm /tmp/factorio_headless_x64_$VERSION.tar.xz \ | ||||
|     && ln -s $SAVES /opt/factorio/saves \ | ||||
|     && ln -s $MODS /opt/factorio/mods \ | ||||
|     && ln -s $SCENARIOS /opt/factorio/scenarios \ | ||||
|     && ln -s $SCRIPTOUTPUT /opt/factorio/script-output \ | ||||
|     && apk del .build-deps \ | ||||
|     && addgroup -g $PGID -S $GROUP \ | ||||
|     && adduser -u $PUID -G $GROUP -s /bin/sh -SDH $USER \ | ||||
|     && chown -R $USER:$GROUP /opt/factorio /factorio | ||||
|  | ||||
| VOLUME /factorio | ||||
|  | ||||
| EXPOSE $PORT/udp $RCON_PORT/tcp | ||||
|  | ||||
| COPY files/ / | ||||
|  | ||||
| ENTRYPOINT ["/docker-entrypoint.sh"] | ||||
| @@ -1,9 +0,0 @@ | ||||
| version: '2' | ||||
| services: | ||||
|   factorio: | ||||
|     build: . | ||||
|     ports: | ||||
|      - "34197:34197/udp" | ||||
|      - "27015:27015/tcp" | ||||
|     volumes: | ||||
|      - /opt/factorio:/factorio | ||||
| @@ -1,62 +0,0 @@ | ||||
| #!/bin/sh -x | ||||
| set -euo pipefail | ||||
|  | ||||
| id | ||||
|  | ||||
| FACTORIO_VOL=/factorio | ||||
| mkdir -p "$FACTORIO_VOL" | ||||
| mkdir -p "$SAVES" | ||||
| mkdir -p "$CONFIG" | ||||
| mkdir -p "$MODS" | ||||
| mkdir -p "$SCENARIOS" | ||||
| mkdir -p "$SCRIPTOUTPUT" | ||||
|  | ||||
| if [ ! -f "$CONFIG/rconpw" ]; then | ||||
|   pwgen 15 1>"$CONFIG/rconpw" | ||||
| fi | ||||
|  | ||||
| if [ ! -f "$CONFIG/server-settings.json" ]; then | ||||
|   cp /opt/factorio/data/server-settings.example.json "$CONFIG/server-settings.json" | ||||
| fi | ||||
|  | ||||
| if [ ! -f "$CONFIG/map-gen-settings.json" ]; then | ||||
|   cp /opt/factorio/data/map-gen-settings.example.json "$CONFIG/map-gen-settings.json" | ||||
| fi | ||||
|  | ||||
| if [ ! -f "$CONFIG/map-settings.json" ]; then | ||||
|   cp /opt/factorio/data/map-settings.example.json "$CONFIG/map-settings.json" | ||||
| fi | ||||
|  | ||||
| if find -L "$SAVES" -iname \*.tmp.zip -mindepth 1 -print | grep -q .; then | ||||
|   rm -f "$SAVES"/*.tmp.zip | ||||
| fi | ||||
|  | ||||
| if [ "$(id -u)" = '0' ]; then | ||||
|   # Update the User and Group ID based on the PUID/PGID variables | ||||
|   usermod -o -u "$PUID" factorio | ||||
|   groupmod -o -g "$PGID" factorio | ||||
|   # Take ownership of factorio data if running as root | ||||
|   chown -R factorio:factorio "$FACTORIO_VOL" | ||||
|   # Drop to the factorio user | ||||
|   SU_EXEC="su-exec factorio" | ||||
| else | ||||
|   SU_EXEC="" | ||||
| fi | ||||
|  | ||||
| if ! find -L "$SAVES" -iname \*.zip -mindepth 1 -print | grep -q .; then | ||||
|   $SU_EXEC /opt/factorio/bin/x64/factorio \ | ||||
|     --create "$SAVES/_autosave1.zip" \ | ||||
|     --map-gen-settings "$CONFIG/map-gen-settings.json" \ | ||||
|     --map-settings "$CONFIG/map-settings.json" | ||||
| fi | ||||
|  | ||||
| $SU_EXEC /opt/factorio/bin/x64/factorio \ | ||||
|   --port "$PORT" \ | ||||
|   --start-server-load-latest \ | ||||
|   --server-settings "$CONFIG/server-settings.json" \ | ||||
|   --server-whitelist "$CONFIG/server-whitelist.json" \ | ||||
|   --server-banlist "$CONFIG/server-banlist.json" \ | ||||
|   --rcon-port "$RCON_PORT" \ | ||||
|   --rcon-password "$(cat "$CONFIG/rconpw")" \ | ||||
|   --server-id /factorio/config/server-id.json \ | ||||
|   "$@" | ||||
| @@ -1,42 +0,0 @@ | ||||
| #!/bin/sh -x | ||||
| if [ -z "$1" ]; then | ||||
|   echo "No argument supplied" | ||||
| fi | ||||
| SERVER_SCENARIO=$1 | ||||
|  | ||||
| set -euo pipefail | ||||
|  | ||||
| id | ||||
|  | ||||
| mkdir -p "$SAVES" | ||||
| mkdir -p "$CONFIG" | ||||
| mkdir -p "$MODS" | ||||
| mkdir -p "$SCENARIOS" | ||||
|  | ||||
| #chown -R factorio /factorio | ||||
|  | ||||
| if [ ! -f "$CONFIG/rconpw" ]; then | ||||
|   pwgen 15 1 >"$CONFIG/rconpw" | ||||
| fi | ||||
|  | ||||
| if [ ! -f "$CONFIG/server-settings.json" ]; then | ||||
|   cp /opt/factorio/data/server-settings.example.json "$CONFIG/server-settings.json" | ||||
| fi | ||||
|  | ||||
| if [ ! -f "$CONFIG/map-gen-settings.json" ]; then | ||||
|   cp /opt/factorio/data/map-gen-settings.example.json "$CONFIG/map-gen-settings.json" | ||||
| fi | ||||
|  | ||||
| if [ ! -f "$CONFIG/map-settings.json" ]; then | ||||
|   cp /opt/factorio/data/map-settings.example.json "$CONFIG/map-settings.json" | ||||
| fi | ||||
|  | ||||
| exec /opt/factorio/bin/x64/factorio \ | ||||
|   --port "$PORT" \ | ||||
|   --start-server-load-scenario "$SERVER_SCENARIO" \ | ||||
|   --server-settings "$CONFIG/server-settings.json" \ | ||||
|   --server-whitelist "$CONFIG/server-whitelist.json" \ | ||||
|   --server-banlist "$CONFIG/server-banlist.json" \ | ||||
|   --rcon-port "$RCON_PORT" \ | ||||
|   --rcon-password "$(cat "$CONFIG/rconpw")" \ | ||||
|   --server-id /factorio/config/server-id.json | ||||
| @@ -1,29 +0,0 @@ | ||||
| #!/bin/sh -x | ||||
| if [ -z "$1" ]; then | ||||
|   echo "No argument supplied" | ||||
| fi | ||||
| SERVER_SCENARIO=$1 | ||||
|  | ||||
| set -euo pipefail | ||||
|  | ||||
| id | ||||
|  | ||||
| mkdir -p "$SAVES" | ||||
| mkdir -p "$CONFIG" | ||||
| mkdir -p "$MODS" | ||||
| mkdir -p "$SCENARIOS" | ||||
|  | ||||
| if [ ! -f "$CONFIG/server-settings.json" ]; then | ||||
|   cp /opt/factorio/data/server-settings.example.json "$CONFIG/server-settings.json" | ||||
| fi | ||||
|  | ||||
| if [ ! -f "$CONFIG/map-gen-settings.json" ]; then | ||||
|   cp /opt/factorio/data/map-gen-settings.example.json "$CONFIG/map-gen-settings.json" | ||||
| fi | ||||
|  | ||||
| if [ ! -f "$CONFIG/map-settings.json" ]; then | ||||
|   cp /opt/factorio/data/map-settings.example.json "$CONFIG/map-settings.json" | ||||
| fi | ||||
|  | ||||
| exec /opt/factorio/bin/x64/factorio \ | ||||
|   --scenario2map "$SERVER_SCENARIO" | ||||
| @@ -1,43 +0,0 @@ | ||||
| FROM frolvlad/alpine-glibc:alpine-3.11 | ||||
|  | ||||
| LABEL maintainer="https://github.com/factoriotools/factorio-docker" | ||||
|  | ||||
| ARG USER=factorio | ||||
| ARG GROUP=factorio | ||||
| ARG PUID=845 | ||||
| ARG PGID=845 | ||||
|  | ||||
| ENV PORT=34197 \ | ||||
|     RCON_PORT=27015 \ | ||||
|     VERSION=0.17.79 \ | ||||
|     SHA1=7f127baf3cf01c6e545a9ca376dec1ac37468f8a \ | ||||
|     SAVES=/factorio/saves \ | ||||
|     CONFIG=/factorio/config \ | ||||
|     MODS=/factorio/mods \ | ||||
|     SCENARIOS=/factorio/scenarios \ | ||||
|     SCRIPTOUTPUT=/factorio/script-output \ | ||||
|     PUID="$PUID" \ | ||||
|     PGID="$PGID" | ||||
|  | ||||
| SHELL ["/bin/ash", "-eo", "pipefail", "-c"] | ||||
| RUN set -ox pipefail \ | ||||
|     && archive="/tmp/factorio_headless_x64_$VERSION.tar.xz" \ | ||||
|     && mkdir -p /opt /factorio \ | ||||
|     && apk add --update --no-cache --no-progress bash binutils curl file gettext jq libintl pwgen shadow su-exec \ | ||||
|     && curl -sSL "https://www.factorio.com/get-download/$VERSION/headless/linux64" -o "$archive" \ | ||||
|     && echo "$SHA1  $archive" | sha1sum -c \ | ||||
|     || (sha1sum "$archive" && file "$archive" && exit 1) \ | ||||
|     && tar xf "$archive" --directory /opt \ | ||||
|     && chmod ugo=rwx /opt/factorio \ | ||||
|     && rm "$archive" \ | ||||
|     && mkdir -p /opt/factorio/config/ \ | ||||
|     && addgroup -g "$PGID" -S "$GROUP" \ | ||||
|     && adduser -u "$PUID" -G "$GROUP" -s /bin/sh -SDH "$USER" \ | ||||
|     && chown -R "$USER":"$GROUP" /opt/factorio /factorio | ||||
|  | ||||
| COPY files/*.sh / | ||||
| COPY files/config.ini /opt/factorio/config/config.ini | ||||
|  | ||||
| VOLUME /factorio | ||||
| EXPOSE $PORT/udp $RCON_PORT/tcp | ||||
| ENTRYPOINT ["/docker-entrypoint.sh"] | ||||
| @@ -1,15 +0,0 @@ | ||||
| version: '2' | ||||
| services: | ||||
|   factorio: | ||||
|     build: . | ||||
|     ports: | ||||
|      - "34197:34197/udp" | ||||
|      - "27015:27015/tcp" | ||||
|     volumes: | ||||
|      - /opt/factorio:/factorio | ||||
| #    environment: | ||||
| #      - PUID=1000 | ||||
| #      - PGID=1000 | ||||
| #      - UPDATE_MODS_ON_START=true | ||||
| #      - USERNAME=FactorioUsername | ||||
| #      - TOKEN=FactorioToken | ||||
| @@ -1,714 +0,0 @@ | ||||
| ; version=5 | ||||
| ; This is INI file : https://en.wikipedia.org/wiki/INI_file#Format  | ||||
| ; Semicolons (;) at the beginning of the line indicate a comment. Comment lines are ignored. | ||||
| [path] | ||||
| read-data=__PATH__executable__/../../data | ||||
| write-data=__PATH__executable__/../.. | ||||
|  | ||||
| [general] | ||||
| locale= | ||||
|  | ||||
| [other] | ||||
| ; Options: true, false | ||||
| ; verbose-logging=false | ||||
|  | ||||
| ; Options: true, false | ||||
| ; log-saving-statistics=false | ||||
|  | ||||
| ; autosave-interval=5 | ||||
|  | ||||
| ; autosave-slots=3 | ||||
|  | ||||
| ; In ticks | ||||
| ; minimum-latency-in-multiplayer=0 | ||||
|  | ||||
| ; In seconds | ||||
| ; multiplayer-initial-connection-timeout=10 | ||||
|  | ||||
| ; port=34197 | ||||
|  | ||||
| ; max-map-preview-chunk-side=64 | ||||
|  | ||||
| ; max-map-preview-threads=7 | ||||
|  | ||||
| ; In bytes | ||||
| ; max-multiplayer-script-reload-size=1048576 | ||||
|  | ||||
| ; Options: true, false | ||||
| ; enable-steam-networking=true | ||||
|  | ||||
| ; proxy= | ||||
|  | ||||
| ; proxy-username= | ||||
|  | ||||
| ; proxy-password= | ||||
|  | ||||
| ; Options: true, false | ||||
| ; check-updates=true | ||||
|  | ||||
| ; Options: true, false | ||||
| ; enable-experimental-updates=false | ||||
|  | ||||
| ; Options: true, false | ||||
| ; enable-new-mods=true | ||||
|  | ||||
| ; Options: true, false | ||||
| ; use-mod-settings-per-save=true | ||||
|  | ||||
| ; Options: true, false | ||||
| ; disable-minimal-mode=false | ||||
|  | ||||
| ; Options: true, false | ||||
| ; disable-blueprint-storage=false | ||||
|  | ||||
| ; Disables tracking which mod created/changed what prototype. Mainly for faster startup during development. | ||||
| ;  | ||||
| ; Options: true, false | ||||
| ; disable-prototype-history=false | ||||
|  | ||||
| ; Print a warning for all prototype values that were not accessed. | ||||
| ;  | ||||
| ; Options: true, false | ||||
| ; check-unused-prototype-data=false | ||||
|  | ||||
| ; Options: true, false | ||||
| ; enable-razer-chroma-support=true | ||||
|  | ||||
| ; Options: true, false | ||||
| ; enable-logitech-led-support=true | ||||
|  | ||||
| ; Options: true, false | ||||
| ; enable-crash-log-uploading=true | ||||
|  | ||||
| ; Options: true, false | ||||
| ; enable-heap-validation=true | ||||
|  | ||||
| ; Options: true, false | ||||
| ; enable-threaded-message-pump=true | ||||
|  | ||||
| ; Options: true, false | ||||
| ; enable-taskbar-animation=true | ||||
|  | ||||
| ; Does nothing on Windows | ||||
| ;  | ||||
| ; Options: true, false | ||||
| ; non-blocking-saving=false | ||||
|  | ||||
| ; Related to MacOS | ||||
| ;  | ||||
| ; Options: true, false | ||||
| ; discard-mouse-events-when-accessibility-zoomed=false | ||||
|  | ||||
| ; Options: true, false | ||||
| ; enable-blueprint-storage-cloud-sync=false | ||||
|  | ||||
| ; Options: fast, maximum | ||||
| ; multiplayer-compression-level=fast | ||||
|  | ||||
| ; Options: none, fast, maximum | ||||
| ; autosave-compression-level=fast | ||||
|  | ||||
| ; Socket to host RCON on when lauching MP server from the menu. | ||||
| ; local-rcon-socket=0.0.0.0:0 | ||||
|  | ||||
| ; Password for RCON when launching MP server from the menu. | ||||
| ; local-rcon-password= | ||||
|  | ||||
|  | ||||
| [interface] | ||||
| ; Options: true, false | ||||
| ; automatic-ui-scale=true | ||||
|  | ||||
| ; custom-ui-scale=1.000000 | ||||
|  | ||||
| ; tooltip-delay=0.040000 | ||||
|  | ||||
| ; entity-tooltip-delay=0.000000 | ||||
|  | ||||
| ; tooltip-offset=20 | ||||
|  | ||||
| ; output-console-delay=1200 | ||||
|  | ||||
| ; train-stop-label-angle=0.085526 | ||||
|  | ||||
| ; active-quick-bars=2 | ||||
|  | ||||
| ; shortcut-bar-rows=2 | ||||
|  | ||||
| ; Options: true, false | ||||
| ; force-default-logistic-filter-count-to-one=false | ||||
|  | ||||
| ; Options: true, false | ||||
| ; autosort-inventory=true | ||||
|  | ||||
| ; Options: true, false | ||||
| ; research-finished-stops-game=false | ||||
|  | ||||
| ; Options: true, false | ||||
| ; use-item-groups=true | ||||
|  | ||||
| ; Options: true, false | ||||
| ; use-item-subgroups=true | ||||
|  | ||||
| ; Options: true, false | ||||
| ; use-version-filter-in-browse-games-gui=true | ||||
|  | ||||
| ; Options: true, false | ||||
| ; use-version-filter-in-install-mods-gui=true | ||||
|  | ||||
| ; Options: true, false | ||||
| ; play-sound-for-chat-messages=true | ||||
|  | ||||
| ; Options: true, false | ||||
| ; fuzzy-search-enabled=false | ||||
|  | ||||
| ; Options: true, false | ||||
| ; pick-ghost-cursor=false | ||||
|  | ||||
| ; Options: true, false | ||||
| ; show-minimap=true | ||||
|  | ||||
| ; Options: true, false | ||||
| ; show-tips-and-tricks=true | ||||
|  | ||||
| ; Options: true, false | ||||
| ; show-tutorial-notifications=true | ||||
|  | ||||
| ; Options: true, false | ||||
| ; show-turret-radius-when-blueprinting=false | ||||
|  | ||||
| ; Options: true, false | ||||
| ; show-item-labels-in-cursor=true | ||||
|  | ||||
| ; Options: true, false | ||||
| ; show-rail-block-visualization=true | ||||
|  | ||||
| ; Options: true, false | ||||
| ; show-missing-logistic-network-icon=true | ||||
|  | ||||
| ; Options: true, false | ||||
| ; show-interaction-indications=true | ||||
|  | ||||
| ; Options: true, false | ||||
| ; show-grid-when-paused=true | ||||
|  | ||||
| ; Options: true, false | ||||
| ; show-inserter-arrows-when-selected=true | ||||
|  | ||||
| ; Options: true, false | ||||
| ; show-inserter-arrows-when-detailed-info-is-on=false | ||||
|  | ||||
| ; Options: true, false | ||||
| ; show-pump-arrows-when-detailed-info-is-on=true | ||||
|  | ||||
| ; Options: true, false | ||||
| ; show-mining-drill-arrows-when-detailed-info-is-on=true | ||||
|  | ||||
| ; Options: true, false | ||||
| ; show-combinator-settings-when-detailed-info-is-on=false | ||||
|  | ||||
| ; Options: true, false | ||||
| ; entity-tooltip-on-the-side=true | ||||
|  | ||||
| ; Options: true, false | ||||
| ; show-mod-owners-in-tooltips=true | ||||
|  | ||||
| ; Options: true, false | ||||
| ; show-descriptions-in-tooltips=true | ||||
|  | ||||
| ; Options: true, false | ||||
| ; show-total-raw-in-recipe-tooltips=true | ||||
|  | ||||
| ; debug-font-size=18 | ||||
|  | ||||
| ; train-visualization-length=5 | ||||
|  | ||||
|  | ||||
| [sound] | ||||
| ; master-volume=0.600000 | ||||
|  | ||||
| ; music-volume=0.400000 | ||||
|  | ||||
| ; game-effects-volume=0.700000 | ||||
|  | ||||
| ; gui-effects-volume=0.700000 | ||||
|  | ||||
| ; walking-sound-volume=0.300000 | ||||
|  | ||||
| ; environment-sounds-volume=0.450000 | ||||
|  | ||||
| ; alerts-volume=0.550000 | ||||
|  | ||||
| ; wind-volume=0.400000 | ||||
|  | ||||
| ; audible-distance=40.000000 | ||||
|  | ||||
| ; environment-audible-distance=15.000000 | ||||
|  | ||||
| ; maximum-environment-sounds=15 | ||||
|  | ||||
| ; active-gui-volume-modifier=1.000000 | ||||
|  | ||||
| ; active-gui-environment-volume-modifier=0.600000 | ||||
|  | ||||
| ; ambient-music-pause-mean-seconds=45.000000 | ||||
|  | ||||
| ; ambient-music-pause-variance-seconds=30.000000 | ||||
|  | ||||
| ; Options: main-tracks-only, interleave-main-tracks-with-interludes, randomize-all | ||||
| ; ambient-music-mode=interleave-main-tracks-with-interludes | ||||
|  | ||||
| ; zoom-audible-distance-coefficient=1.000000 | ||||
|  | ||||
| ; zoom-volume-coefficient=2.000000 | ||||
|  | ||||
|  | ||||
| [map-view] | ||||
| ; Options: true, false | ||||
| ; show-logistic-network=false | ||||
|  | ||||
| ; Options: true, false | ||||
| ; show-electric-network=false | ||||
|  | ||||
| ; Options: true, false | ||||
| ; show-turret-range=false | ||||
|  | ||||
| ; Options: true, false | ||||
| ; show-pollution=true | ||||
|  | ||||
| ; Options: true, false | ||||
| ; show-networkless-logistic-members=false | ||||
|  | ||||
| ; Options: true, false | ||||
| ; show-train-station-names=true | ||||
|  | ||||
| ; Options: true, false | ||||
| ; show-player-names=true | ||||
|  | ||||
| ; Options: true, false | ||||
| ; show-non-standard-map-info=false | ||||
|  | ||||
|  | ||||
| [debug] | ||||
| ; force=enemy | ||||
|  | ||||
| ; Options: true, false | ||||
| ; capture-perf-statistics=false | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-fps=debug | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-detailed-info=debug | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-time-usage=debug | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-gpu-time-usage=debug | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-sprite-counts=never | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-lua-object-statistics=never | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-multiplayer-waiting-icon=debug | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-multiplayer-statistics=debug | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-multiplayer-selection-rectangles=never | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-debug-info-in-tooltips=debug | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; hide-mod-guis=never | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-tile-grid=never | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-collision-rectangles=never | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-selection-rectangles=never | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-render-rectangles=never | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-entity-positions=never | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-entity-velocities=never | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-selected-entity-advanced-tiles=never | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-selected-input-transport-belts=never | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-paths=never | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-path-requests=never | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-next-waypoint-bb=never | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-target=never | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-unit-group-info=never | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-unit-behavior-info=never | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-pathfinder-fringe=never | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-path-cache=never | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-path-cache-paths=never | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-rail-paths=never | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-rolling-stock-count=never | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-rail-connections=never | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-rail-joints=never | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-rail-signal-states=never | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-rail-segment-collision-boxes=never | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-train-stop-point=never | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-train-braking-distance=never | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-train-signals=never | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-train-repathing=never | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-network-connected-entities=never | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-circuit-network-numbers=never | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-energy-sources-networks=never | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-active-state=never | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-wakeup-lists=never | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-transport-lines=never | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-transport-line-gaps=never | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-pollution-values=never | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-active-entities-on-chunk-counts=never | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-active-chunks=never | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-polluted-chunks=never | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-enemy-expansion-candidate-chunks=never | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-enemy-expansion-candidate-chunk-values=never | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-bad-attack-chunks=never | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-tile-variations=never | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-raw-tile-transitions=never | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-fluid-box-fluid-info=never | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-environment-sound-info=never | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-logistic-robot-targets=never | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-logistic-robots-on-map=never | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-recipe-icons-on-map=never | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-player-robots=never | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-fire-info=never | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-sticker-info=never | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-decorative-names=never | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-decorative-collision-rectangles=never | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; allow-increased-zoom=never | ||||
|  | ||||
| ; Options: always, debug, never | ||||
| ; show-chunk-components=never | ||||
|  | ||||
|  | ||||
| [multiplayer-lobby] | ||||
| ; name= | ||||
|  | ||||
| ; description= | ||||
|  | ||||
| ; Options: true, false | ||||
| ; visibility-public=true | ||||
|  | ||||
| ; Options: true, false | ||||
| ; visibility-steam=true | ||||
|  | ||||
| ; Options: true, false | ||||
| ; visibility-lan=true | ||||
|  | ||||
| ; max-players=0 | ||||
|  | ||||
| ; Options: true, false | ||||
| ; ignore-player-limit-when-returning=false | ||||
|  | ||||
| ; max-upload-in-kilobytes-per-second=0 | ||||
|  | ||||
| ; max-upload-slots=5 | ||||
|  | ||||
| ; password= | ||||
|  | ||||
| ; tag-list= | ||||
|  | ||||
| ; afk-auto-kick=0 | ||||
|  | ||||
| ; Options: true, false, admins-only | ||||
| ; allowed-commands=admins-only | ||||
|  | ||||
| ; Options: true, false | ||||
| ; only-admins-can-pause=true | ||||
|  | ||||
| ; Options: true, false | ||||
| ; autosave-only-on-server=true | ||||
|  | ||||
| ; Options: true, false | ||||
| ; non-blocking-saving=true | ||||
|  | ||||
| ; Options: true, false | ||||
| ; verify-user-identity=true | ||||
|  | ||||
| ; Options: true, false | ||||
| ; enable-whitelist=false | ||||
|  | ||||
|  | ||||
| [graphics] | ||||
| ; lights-render-quality=0.250000 | ||||
|  | ||||
| ; Default preferred display index should force finding primary monitor | ||||
| ; preferred-display-index=255 | ||||
|  | ||||
| ; screenshots-threads-count=8 | ||||
|  | ||||
| ; cache-sprite-atlas-count=1 | ||||
|  | ||||
| ; Options: true, false | ||||
| ; cache-sprite-atlas=false | ||||
|  | ||||
| ; Options: true, false | ||||
| ; compress-sprite-atlas-cache=false | ||||
|  | ||||
| ; Options: true, false | ||||
| ; texture-streaming=true | ||||
|  | ||||
| ; streamed-atlas-physical-vram-size=0 | ||||
|  | ||||
| ; sprite-vertex-buffer-size=1048576 | ||||
|  | ||||
| ; max-texture-size=0 | ||||
|  | ||||
| ; max-threads=8 | ||||
|  | ||||
| ; 'low' and 'very-low' options are deprecated and will be migrated to 'normal' | ||||
| ;  | ||||
| ; Options: high, normal, low, very-low | ||||
| ; graphics-quality=normal | ||||
|  | ||||
| ; Options: true, false | ||||
| ; full-screen=true | ||||
|  | ||||
| ; Options: true, false | ||||
| ; minimize-on-focus-loss=false | ||||
|  | ||||
| ; Options: true, false | ||||
| ; show-smoke=true | ||||
|  | ||||
| ; Options: true, false | ||||
| ; show-clouds=true | ||||
|  | ||||
| ; Options: true, false | ||||
| ; show-decoratives=true | ||||
|  | ||||
| ; Options: true, false | ||||
| ; show-item-shadows=true | ||||
|  | ||||
| ; Options: true, false | ||||
| ; show-inserter-shadows=true | ||||
|  | ||||
| ; Options: true, false | ||||
| ; force-opengl=false | ||||
|  | ||||
| ; Options: true, false | ||||
| ; v-sync=true | ||||
|  | ||||
| ; Options: true, false | ||||
| ; high-quality-animations=true | ||||
|  | ||||
| ; Options: true, false | ||||
| ; high-quality-shadows=false | ||||
|  | ||||
| ; Options: true, false | ||||
| ; high-quality-terrain=true | ||||
|  | ||||
| ; Minimum number of turrets required to turn on the turret range overdraw optimization | ||||
| ; turret-overdraw-minimum-count=4 | ||||
|  | ||||
| ; Scale at which the turret range overdraw optimization will start being applied | ||||
| ; turret-overdraw-scale-threshold=0.200000 | ||||
|  | ||||
| ; Options: true, false | ||||
| ; skip-vram-detection=false | ||||
|  | ||||
| ; Options: true, false | ||||
| ; halt-rendering-when-minimized=true | ||||
|  | ||||
| ; Options: true, false | ||||
| ; runtime-sprite-reload=false | ||||
|  | ||||
| ; Options: true, false | ||||
| ; full-color-depth=true | ||||
|  | ||||
| ; Options: true, false | ||||
| ; render-in-native-resolution=true | ||||
|  | ||||
| ; Options: true, false | ||||
| ; use-flip-presentation-model=false | ||||
|  | ||||
| ; Options: true, false | ||||
| ; debug-api=false | ||||
|  | ||||
| ; Options: true, false | ||||
| ; discard-buffers-on-begin-frame=true | ||||
|  | ||||
| ; Options: all, high, medium, low | ||||
| ; video-memory-usage=high | ||||
|  | ||||
| ; Options: none, high-quality, low-quality | ||||
| ; texture-compression-level=high-quality | ||||
|  | ||||
| ; Options: true, false | ||||
| ; compress-virtual-atlas=true | ||||
|  | ||||
| ; Options: copy, copy-sequential, flip, flip-discard | ||||
| ; dxgi-presentation-model=copy | ||||
|  | ||||
| ; Options: none, flush, wait-for-vblank, flush-and-wait-for-vblank | ||||
| ; dxgi-action-before-present=none | ||||
|  | ||||
| ; relevant only for flip presentation models | ||||
| ;  | ||||
| ; Options: true, false | ||||
| ; dxgi-allow-tearing=false | ||||
|  | ||||
| ; Options: false, true, auto | ||||
| ; dxgi-flip-do-not-wait=false | ||||
|  | ||||
| ; Options: true, false | ||||
| ; dxgi-present-restart=false | ||||
|  | ||||
| ; dxgi-swap-chain-buffer-count=0 | ||||
|  | ||||
| ; dxgi-max-frame-latency=0 | ||||
|  | ||||
| ; dxgi-adapter-index=-1 | ||||
|  | ||||
| ; max-sprite-loading-threads=32 | ||||
|  | ||||
| ; Options: true, false | ||||
| ; gpu-accelerated-compression=true | ||||
|  | ||||
| ; Options: true, false | ||||
| ; gpu-accelerated-mipmap-compression=true | ||||
|  | ||||
| ; Options: true, false | ||||
| ; wait-until-mipmap-generation-finished=true | ||||
|  | ||||
| ; Options: true, false | ||||
| ; check-for-unused-pixels=false | ||||
|  | ||||
| ; ogl-depth-buffer-bit-depth=0 | ||||
|  | ||||
| ; Options: false, true, auto | ||||
| ; ogl-accelerated-renderer=auto | ||||
|  | ||||
| ; Options: true, false | ||||
| ; ogl-double-buffered=true | ||||
|  | ||||
| ; Set to true if mipmapped sprites render very blurry on your GPU. Limited support. | ||||
| ;  | ||||
| ; Options: true, false | ||||
| ; legacy-gpu-no-mipmaps=false | ||||
|  | ||||
| ; Options: true, false | ||||
| ; force-linear-magnification=false | ||||
|  | ||||
| ; Options: true, false | ||||
| ; custom-mipmap-workaround=false | ||||
|  | ||||
| ; Options: true, false | ||||
| ; buffer-rename-workaround=false | ||||
|  | ||||
| ; Comma separated list of OpenGL extensions that should not be used (for example: ARB_copy_image,KHR_debug) | ||||
| ; disabled-opengl-extensions= | ||||
|  | ||||
|  | ||||
| @@ -1,98 +0,0 @@ | ||||
| #!/bin/bash | ||||
| set -eoux pipefail | ||||
|  | ||||
| FACTORIO_VOL=/factorio | ||||
| LOAD_LATEST_SAVE="${LOAD_LATEST_SAVE:-true}" | ||||
| GENERATE_NEW_SAVE="${GENERATE_NEW_SAVE:-false}" | ||||
| SAVE_NAME="${SAVE_NAME:-""}" | ||||
|  | ||||
| mkdir -p "$FACTORIO_VOL" | ||||
| mkdir -p "$SAVES" | ||||
| mkdir -p "$CONFIG" | ||||
| mkdir -p "$MODS" | ||||
| mkdir -p "$SCENARIOS" | ||||
| mkdir -p "$SCRIPTOUTPUT" | ||||
|  | ||||
| if [[ ! -f $CONFIG/rconpw ]]; then | ||||
|   # Generate a new RCON password if none exists | ||||
|   pwgen 15 1 >"$CONFIG/rconpw" | ||||
| fi | ||||
|  | ||||
| if [[ ! -f $CONFIG/server-settings.json ]]; then | ||||
|   # Copy default settings if server-settings.json doesn't exist | ||||
|   cp /opt/factorio/data/server-settings.example.json "$CONFIG/server-settings.json" | ||||
| fi | ||||
|  | ||||
| if [[ ! -f $CONFIG/map-gen-settings.json ]]; then | ||||
|   cp /opt/factorio/data/map-gen-settings.example.json "$CONFIG/map-gen-settings.json" | ||||
| fi | ||||
|  | ||||
| if [[ ! -f $CONFIG/map-settings.json ]]; then | ||||
|   cp /opt/factorio/data/map-settings.example.json "$CONFIG/map-settings.json" | ||||
| fi | ||||
|  | ||||
| NRTMPSAVES=$( find -L "$SAVES" -iname \*.tmp.zip -mindepth 1 | wc -l ) | ||||
| if [[ $NRTMPSAVES -gt 0 ]]; then | ||||
|   # Delete incomplete saves (such as after a forced exit) | ||||
|   rm -f "$SAVES"/*.tmp.zip | ||||
| fi | ||||
|  | ||||
| if [[ ${UPDATE_MODS_ON_START:-} == "true" ]]; then | ||||
|   ./docker-update-mods.sh | ||||
| fi | ||||
|  | ||||
| if [[ $(id -u) = 0 ]]; then | ||||
|   # Update the User and Group ID based on the PUID/PGID variables | ||||
|   usermod -o -u "$PUID" factorio | ||||
|   groupmod -o -g "$PGID" factorio | ||||
|   # Take ownership of factorio data if running as root | ||||
|   chown -R factorio:factorio "$FACTORIO_VOL" | ||||
|   # Drop to the factorio user | ||||
|   SU_EXEC="su-exec factorio" | ||||
| else | ||||
|   SU_EXEC="" | ||||
| fi | ||||
|  | ||||
| sed -i '/write-data=/c\write-data=\/factorio/' /opt/factorio/config/config.ini | ||||
|  | ||||
| NRSAVES=$(find -L "$SAVES" -iname \*.zip -mindepth 1 | wc -l) | ||||
| if [[ $GENERATE_NEW_SAVE != true && $NRSAVES ==  0 ]]; then | ||||
|     GENERATE_NEW_SAVE=true | ||||
|     SAVE_NAME=_autosave1 | ||||
| fi | ||||
|  | ||||
| if [[ $GENERATE_NEW_SAVE == true ]]; then | ||||
|     if [[ -z "$SAVE_NAME" ]]; then | ||||
|         echo "If \$GENERATE_NEW_SAVE is true, you must specify \$SAVE_NAME" | ||||
|         exit 1 | ||||
|     fi | ||||
|     if [[ -f "$SAVES/$SAVE_NAME.zip" ]]; then | ||||
|         echo "Map $SAVES/$SAVE_NAME.zip already exists, skipping map generation" | ||||
|     else | ||||
|         $SU_EXEC /opt/factorio/bin/x64/factorio \ | ||||
|             --create "$SAVES/$SAVE_NAME.zip" \ | ||||
|             --map-gen-settings "$CONFIG/map-gen-settings.json" \ | ||||
|             --map-settings "$CONFIG/map-settings.json" | ||||
|     fi | ||||
| fi | ||||
|  | ||||
| FLAGS=(\ | ||||
|   --port "$PORT" \ | ||||
|   --server-settings "$CONFIG/server-settings.json" \ | ||||
|   --server-banlist "$CONFIG/server-banlist.json" \ | ||||
|   --rcon-port "$RCON_PORT" \ | ||||
|   --server-whitelist "$CONFIG/server-whitelist.json" \ | ||||
|   --use-server-whitelist \ | ||||
|   --server-adminlist "$CONFIG/server-adminlist.json" \ | ||||
|   --rcon-password "$(cat "$CONFIG/rconpw")" \ | ||||
|   --server-id /factorio/config/server-id.json \ | ||||
| ) | ||||
|  | ||||
| if [[ $LOAD_LATEST_SAVE == true ]]; then | ||||
|     FLAGS+=( --start-server-load-latest ) | ||||
| else | ||||
|     FLAGS+=( --start-server "$SAVE_NAME" ) | ||||
| fi | ||||
|  | ||||
| # shellcheck disable=SC2086 | ||||
| exec $SU_EXEC /opt/factorio/bin/x64/factorio "${FLAGS[@]}" "$@" | ||||
| @@ -1,43 +0,0 @@ | ||||
| FROM frolvlad/alpine-glibc:alpine-3.12 | ||||
|  | ||||
| LABEL maintainer="https://github.com/factoriotools/factorio-docker" | ||||
|  | ||||
| ARG USER=factorio | ||||
| ARG GROUP=factorio | ||||
| ARG PUID=845 | ||||
| ARG PGID=845 | ||||
|  | ||||
| ENV PORT=34197 \ | ||||
|     RCON_PORT=27015 \ | ||||
|     VERSION=0.18.32 \ | ||||
|     SHA1=7b47fcab772b573c04443d9db0922a32f81f0b5c \ | ||||
|     SAVES=/factorio/saves \ | ||||
|     CONFIG=/factorio/config \ | ||||
|     MODS=/factorio/mods \ | ||||
|     SCENARIOS=/factorio/scenarios \ | ||||
|     SCRIPTOUTPUT=/factorio/script-output \ | ||||
|     PUID="$PUID" \ | ||||
|     PGID="$PGID" | ||||
|  | ||||
| SHELL ["/bin/ash", "-eo", "pipefail", "-c"] | ||||
| RUN set -ox pipefail \ | ||||
|     && archive="/tmp/factorio_headless_x64_$VERSION.tar.xz" \ | ||||
|     && mkdir -p /opt /factorio \ | ||||
|     && apk add --update --no-cache --no-progress bash binutils curl file gettext jq libintl pwgen shadow su-exec \ | ||||
|     && curl -sSL "https://www.factorio.com/get-download/$VERSION/headless/linux64" -o "$archive" \ | ||||
|     && echo "$SHA1  $archive" | sha1sum -c \ | ||||
|     || (sha1sum "$archive" && file "$archive" && exit 1) \ | ||||
|     && tar xf "$archive" --directory /opt \ | ||||
|     && chmod ugo=rwx /opt/factorio \ | ||||
|     && rm "$archive" \ | ||||
|     && mkdir -p /opt/factorio/config/ \ | ||||
|     && addgroup -g "$PGID" -S "$GROUP" \ | ||||
|     && adduser -u "$PUID" -G "$GROUP" -s /bin/sh -SDH "$USER" \ | ||||
|     && chown -R "$USER":"$GROUP" /opt/factorio /factorio | ||||
|  | ||||
| COPY files/*.sh / | ||||
| COPY files/config.ini /opt/factorio/config/config.ini | ||||
|  | ||||
| VOLUME /factorio | ||||
| EXPOSE $PORT/udp $RCON_PORT/tcp | ||||
| ENTRYPOINT ["/docker-entrypoint.sh"] | ||||
| @@ -1,15 +0,0 @@ | ||||
| version: '2' | ||||
| services: | ||||
|   factorio: | ||||
|     build: . | ||||
|     ports: | ||||
|      - "34197:34197/udp" | ||||
|      - "27015:27015/tcp" | ||||
|     volumes: | ||||
|      - /opt/factorio:/factorio | ||||
| #    environment: | ||||
| #      - PUID=1000 | ||||
| #      - PGID=1000 | ||||
| #      - UPDATE_MODS_ON_START=true | ||||
| #      - USERNAME=FactorioUsername | ||||
| #      - TOKEN=FactorioToken | ||||
| @@ -1,28 +0,0 @@ | ||||
| #!/bin/bash | ||||
| set -eou pipefail | ||||
|  | ||||
| if [[ -f /run/secrets/username ]]; then | ||||
|   USERNAME=$(cat /run/secrets/username) | ||||
| fi | ||||
|  | ||||
| if [[ -f /run/secrets/username ]]; then | ||||
|   TOKEN=$(cat /run/secrets/token) | ||||
| fi | ||||
|  | ||||
| if [[ -z ${USERNAME:-} ]]; then | ||||
|   USERNAME="$(jq -j ".username" "$CONFIG/server-settings.json")" | ||||
| fi | ||||
|  | ||||
| if [[ -z ${TOKEN:-} ]]; then | ||||
|   TOKEN="$(jq -j ".token" "$CONFIG/server-settings.json")" | ||||
| fi | ||||
|  | ||||
| if [[ -z ${USERNAME:-} ]]; then | ||||
|   echo "You need to provide your Factorio username to update mods." | ||||
| fi | ||||
|  | ||||
| if [[ -z ${TOKEN:-} ]]; then | ||||
|   echo "You need to provide your Factorio token to update mods." | ||||
| fi | ||||
|  | ||||
| ./update-mods.sh "$VERSION" "$MODS" "$USERNAME" "$TOKEN" | ||||
| @@ -1,42 +0,0 @@ | ||||
| #!/bin/bash | ||||
| set -eoux pipefail | ||||
|  | ||||
| if [[ -z ${1:-} ]]; then | ||||
|   echo "No argument supplied" | ||||
| fi | ||||
|  | ||||
| SERVER_SCENARIO="$1" | ||||
| mkdir -p "$SAVES" | ||||
| mkdir -p "$CONFIG" | ||||
| mkdir -p "$MODS" | ||||
| mkdir -p "$SCENARIOS" | ||||
|  | ||||
| #chown -R factorio /factorio | ||||
|  | ||||
| if [[ ! -f $CONFIG/rconpw ]]; then | ||||
|   pwgen 15 1 >"$CONFIG/rconpw" | ||||
| fi | ||||
|  | ||||
| if [[ ! -f $CONFIG/server-settings.json ]]; then | ||||
|   cp /opt/factorio/data/server-settings.example.json "$CONFIG/server-settings.json" | ||||
| fi | ||||
|  | ||||
| if [[ ! -f $CONFIG/map-gen-settings.json ]]; then | ||||
|   cp /opt/factorio/data/map-gen-settings.example.json "$CONFIG/map-gen-settings.json" | ||||
| fi | ||||
|  | ||||
| if [[ ! -f $CONFIG/map-settings.json ]]; then | ||||
|   cp /opt/factorio/data/map-settings.example.json "$CONFIG/map-settings.json" | ||||
| fi | ||||
|  | ||||
| exec /opt/factorio/bin/x64/factorio \ | ||||
|   --port "$PORT" \ | ||||
|   --start-server-load-scenario "$SERVER_SCENARIO" \ | ||||
|   --server-settings "$CONFIG/server-settings.json" \ | ||||
|   --server-banlist "$CONFIG/server-banlist.json" \ | ||||
|   --server-whitelist "$CONFIG/server-whitelist.json" \ | ||||
|   --use-server-whitelist \ | ||||
|   --server-adminlist "$CONFIG/server-adminlist.json" \ | ||||
|   --rcon-port "$RCON_PORT" \ | ||||
|   --rcon-password "$(cat "$CONFIG/rconpw")" \ | ||||
|   --server-id /factorio/config/server-id.json | ||||
| @@ -1,27 +0,0 @@ | ||||
| #!/bin/bash | ||||
| set -eoux pipefail | ||||
|  | ||||
| if [[ -z ${1:-} ]]; then | ||||
|   echo "No argument supplied" | ||||
| fi | ||||
|  | ||||
| SERVER_SCENARIO="$1" | ||||
| mkdir -p "$SAVES" | ||||
| mkdir -p "$CONFIG" | ||||
| mkdir -p "$MODS" | ||||
| mkdir -p "$SCENARIOS" | ||||
|  | ||||
| if [[ ! -f $CONFIG/server-settings.json ]]; then | ||||
|   cp /opt/factorio/data/server-settings.example.json "$CONFIG/server-settings.json" | ||||
| fi | ||||
|  | ||||
| if [[ ! -f $CONFIG/map-gen-settings.json ]]; then | ||||
|   cp /opt/factorio/data/map-gen-settings.example.json "$CONFIG/map-gen-settings.json" | ||||
| fi | ||||
|  | ||||
| if [[ ! -f $CONFIG/map-settings.json ]]; then | ||||
|   cp /opt/factorio/data/map-settings.example.json "$CONFIG/map-settings.json" | ||||
| fi | ||||
|  | ||||
| exec /opt/factorio/bin/x64/factorio \ | ||||
|   --scenario2map "$SERVER_SCENARIO" | ||||
| @@ -1,95 +0,0 @@ | ||||
| #!/bin/bash | ||||
| set -eou pipefail | ||||
|  | ||||
| FACTORIO_VERSION=$1 | ||||
| MOD_DIR=$2 | ||||
| USERNAME=$3 | ||||
| TOKEN=$4 | ||||
|  | ||||
| MOD_BASE_URL="https://mods.factorio.com" | ||||
|  | ||||
| print_step() | ||||
| { | ||||
|   echo "$1" | ||||
| } | ||||
|  | ||||
| print_success() | ||||
| { | ||||
|   echo "$1" | ||||
| } | ||||
|  | ||||
| print_failure() | ||||
| { | ||||
|   echo "$1" | ||||
| } | ||||
|  | ||||
| update_mod() | ||||
| { | ||||
|   MOD_NAME="${1// /%20}" | ||||
|  | ||||
|   print_step "Checking for update of mod $MOD_NAME..." | ||||
|  | ||||
|   MOD_INFO_URL="$MOD_BASE_URL/api/mods/$MOD_NAME" | ||||
|   MOD_INFO_JSON=$(curl --silent "$MOD_INFO_URL") | ||||
|  | ||||
|   if ! echo "$MOD_INFO_JSON" | jq -e .name >/dev/null; then | ||||
|     print_success "  Custom mod not on $MOD_BASE_URL, skipped." | ||||
|     return 0 | ||||
|   fi | ||||
|  | ||||
|   MOD_INFO=$(echo "$MOD_INFO_JSON" | jq -j --arg version "$FACTORIO_VERSION" ".releases|reverse|map(select(.info_json.factorio_version as \$mod_version | \$version | startswith(\$mod_version)))[0]|.file_name, \";\", .download_url, \";\", .sha1") | ||||
|  | ||||
|   MOD_FILENAME=$(echo "$MOD_INFO" | cut -f1 -d";") | ||||
|   MOD_URL=$(echo "$MOD_INFO" | cut -f2 -d";") | ||||
|   MOD_SHA1=$(echo "$MOD_INFO" | cut -f3 -d";") | ||||
|  | ||||
|   if [[ $MOD_FILENAME == null ]]; then | ||||
|     print_failure "  Not compatible with version" | ||||
|     return 0 | ||||
|   fi | ||||
|  | ||||
|   if [[ -f $MOD_DIR/$MOD_FILENAME ]]; then | ||||
|     print_success "  Already up-to-date." | ||||
|     return 0 | ||||
|   fi | ||||
|  | ||||
|   print_step "Downloading..." | ||||
|   FULL_URL="$MOD_BASE_URL$MOD_URL?username=$USERNAME&token=$TOKEN" | ||||
|   HTTP_STATUS=$(curl --silent -L -w "%{http_code}" -o "$MOD_DIR/$MOD_FILENAME" "$FULL_URL") | ||||
|  | ||||
|   if [[ $HTTP_STATUS != 200 ]]; then | ||||
|     print_failure "  Download failed: Code $HTTP_STATUS." | ||||
|     rm -f "$MOD_DIR/$MOD_FILENAME" | ||||
|     return 1 | ||||
|   fi | ||||
|  | ||||
|   if [[ ! -f $MOD_DIR/$MOD_FILENAME ]]; then | ||||
|     print_failure "  Downloaded file missing!" | ||||
|     return 1 | ||||
|   fi | ||||
|  | ||||
|   if ! [[ $(sha1sum "$MOD_DIR/$MOD_FILENAME") =~ $MOD_SHA1 ]]; then | ||||
|     print_failure "  SHA1 mismatch!" | ||||
|     rm -f "$MOD_DIR/$MOD_FILENAME" | ||||
|     return 1 | ||||
|   fi | ||||
|  | ||||
|   print_success "  Download complete." | ||||
|  | ||||
|   for file in "$MOD_DIR/${MOD_NAME}_"*".zip"; do # wildcard does usually not work in quotes: https://unix.stackexchange.com/a/67761 | ||||
|     if [[ $file != $MOD_DIR/$MOD_FILENAME ]]; then | ||||
|       print_success "  Deleting old version: $file" | ||||
|       rm -f "$file" | ||||
|     fi | ||||
|   done | ||||
|  | ||||
|   return 0 | ||||
| } | ||||
|  | ||||
| if [[ -f $MOD_DIR/mod-list.json ]]; then | ||||
|   jq -r ".mods|map(select(.enabled))|.[].name" "$MOD_DIR/mod-list.json" | while read -r mod; do | ||||
|     if [[ $mod != base ]]; then | ||||
|       update_mod "$mod" | ||||
|     fi | ||||
|   done | ||||
| fi | ||||
							
								
								
									
										101
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										101
									
								
								README.md
									
									
									
									
									
								
							| @@ -1,10 +1,21 @@ | ||||
| # Factorio [](https://travis-ci.org/factoriotools/factorio-docker)  [](https://hub.docker.com/r/factoriotools/factorio/) [](https://hub.docker.com/r/factoriotools/factorio/) [](https://hub.docker.com/r/factoriotools/factorio/) [](https://microbadger.com/images/factoriotools/factorio "Get your own image badge on microbadger.com") | ||||
| # Factorio [](https://hub.docker.com/r/factoriotools/factorio/) [](https://hub.docker.com/r/factoriotools/factorio/) [](https://hub.docker.com/r/factoriotools/factorio/) | ||||
|  | ||||
| * `0.18.32`, `0.18`, `latest` [(0.18/Dockerfile)](https://github.com/factoriotools/factorio-docker/blob/master/0.18/Dockerfile) | ||||
| * `0.17.79`, `0.17`, `stable` [(0.17/Dockerfile)](https://github.com/factoriotools/factorio-docker/blob/master/0.17/Dockerfile) | ||||
| * `0.16.51`, `0.16` [(0.16/Dockerfile)](https://github.com/factoriotools/factorio-docker/blob/master/0.16/Dockerfile) | ||||
| * `0.15.40`, `0.15` [(0.15/Dockerfile)](https://github.com/factoriotools/factorio-docker/blob/master/0.15/Dockerfile) | ||||
| * `0.14.23`, `0.14` [(0.14/Dockerfile)](https://github.com/factoriotools/factorio-docker/blob/master/0.14/Dockerfile) | ||||
| > [!NOTE] | ||||
| > Support for ARM is experimental. Expect crashes and lag if you try to run this on a raspberry pi. | ||||
|  | ||||
| [中文](./README_zh_CN.md) | ||||
|  | ||||
| <!-- start autogeneration tags --> | ||||
| * `2`, `2.0`, `2.0.9`, `stable`, `stable-2.0.9` | ||||
| * `2.0.10`, `latest` | ||||
| * `1`, `1.1`, `1.1.110`, `stable-1.1.110` | ||||
| * `1.0`, `1.0.0` | ||||
| * `0.17`, `0.17.79` | ||||
| * `0.16`, `0.16.51` | ||||
| * `0.15`, `0.15.40` | ||||
| * `0.14`, `0.14.23` | ||||
| * `0.13`, `0.13.20` | ||||
| * `0.12`, `0.12.35`<!-- end autogeneration tags --> | ||||
|  | ||||
| ## Tag descriptions | ||||
|  | ||||
| @@ -38,7 +49,7 @@ sudo docker run -d \ | ||||
|   -p 27015:27015/tcp \ | ||||
|   -v /opt/factorio:/factorio \ | ||||
|   --name factorio \ | ||||
|   --restart=always \ | ||||
|   --restart=unless-stopped \ | ||||
|   factoriotools/factorio | ||||
| ``` | ||||
|  | ||||
| @@ -87,7 +98,7 @@ docker attach factorio | ||||
|  | ||||
| Before upgrading backup the save. It's easy to make a save in the client. | ||||
|  | ||||
| Ensure `-v` was used to run the server so the save is outside of the Docker container. The `docker rm` command completely destroys the container, which includes the save if it isn't stored in an data volume. | ||||
| Ensure `-v` was used to run the server so the save is outside of the Docker container. The `docker rm` command completely destroys the container, which includes the save if it isn't stored in a data volume. | ||||
|  | ||||
| Delete the container and refresh the image: | ||||
|  | ||||
| @@ -121,7 +132,7 @@ sudo docker run -d \ | ||||
|   -e LOAD_LATEST_SAVE=false \ | ||||
|   -e SAVE_NAME=replaceme \ | ||||
|   --name factorio \ | ||||
|   --restart=always \ | ||||
|   --restart=unless-stopped \ | ||||
|   factoriotools/factorio | ||||
| ``` | ||||
|  | ||||
| @@ -136,7 +147,7 @@ sudo docker run -d \ | ||||
|   -e GENERATE_NEW_SAVE=true \ | ||||
|   -e SAVE_NAME=replaceme \ | ||||
|   --name factorio \ | ||||
|   --restart=always \ | ||||
|   --restart=unless-stopped \ | ||||
|   factoriotools/factorio | ||||
| ``` | ||||
|  | ||||
| @@ -156,7 +167,7 @@ docker run -d \ | ||||
|   -p 27015:27015/tcp \ | ||||
|   -v /opt/factorio:/factorio \ | ||||
|   --name factorio \ | ||||
|   --restart=always  \ | ||||
|   --restart=unless-stopped  \ | ||||
|   --entrypoint "/scenario.sh" \ | ||||
|   factoriotools/factorio \ | ||||
|   MyScenarioName | ||||
| @@ -172,7 +183,7 @@ docker run -d \ | ||||
|   -p 27015:27015/tcp \ | ||||
|   -v /opt/factorio:/factorio \ | ||||
|   --name factorio \ | ||||
|   --restart=always  \ | ||||
|   --restart=unless-stopped  \ | ||||
|   --entrypoint "/scenario2map.sh" \ | ||||
|   factoriotools/factorio | ||||
|   MyScenarioName | ||||
| @@ -203,8 +214,8 @@ Create file `config/server-banlist.json` and add the banlisted users. | ||||
|  | ||||
| ```json | ||||
| [ | ||||
|     "bad_person", | ||||
|     "other_bad_person" | ||||
| "bad_person", | ||||
| "other_bad_person" | ||||
| ] | ||||
| ``` | ||||
|  | ||||
| @@ -214,8 +225,8 @@ Create file `config/server-adminlist.json` and add the adminlisted users. | ||||
|  | ||||
| ```json | ||||
| [ | ||||
|   "you", | ||||
|   "friend" | ||||
| "you", | ||||
| "friend" | ||||
| ] | ||||
| ``` | ||||
|  | ||||
| @@ -246,6 +257,27 @@ The `server-settings.json` file may then contain the variable references like th | ||||
| "description": "${INSTANCE_DESC}", | ||||
| ``` | ||||
|  | ||||
| ### Environment Variables | ||||
|  | ||||
| These are the environment variables which can be specified at container run time. | ||||
|  | ||||
| | Variable Name        | Description                                                          | Default        | Available in | | ||||
| |----------------------|----------------------------------------------------------------------|----------------|--------------| | ||||
| | GENERATE_NEW_SAVE    | Generate a new save if one does not exist before starting the server | false          | 0.17+        | | ||||
| | LOAD_LATEST_SAVE     | Load latest when true. Otherwise load SAVE_NAME                      | true           | 0.17+        | | ||||
| | PORT                 | UDP port the server listens on                                       | 34197          | 0.15+        | | ||||
| | BIND                 | IP address (v4 or v6) the server listens on (IP\[:PORT])             |                | 0.15+        | | ||||
| | RCON_PORT            | TCP port the rcon server listens on                                  | 27015          | 0.15+        | | ||||
| | SAVE_NAME            | Name to use for the save file                                        | _autosave1     | 0.17+        | | ||||
| | TOKEN                | factorio.com token                                                   |                | 0.17+        | | ||||
| | UPDATE_MODS_ON_START | If mods should be updated before starting the server                 |                | 0.17+        | | ||||
| | USERNAME             | factorio.com username                                                |                | 0.17+        | | ||||
| | CONSOLE_LOG_LOCATION | Saves the console log to the specifies location                      |                |              | | ||||
| | DLC_SPACE_AGE        | Enables or disables the mods for DLC Space Age in mod-list.json[^1]  | true           | 2.0.8+       | | ||||
| | MODS                 | Mod directory to use                                                 | /factorio/mods | 2.0.8+       | | ||||
|  | ||||
| **Note:** All environment variables are compared as strings | ||||
|  | ||||
| ## Container Details | ||||
|  | ||||
| The philosophy is to [keep it simple](http://wiki.c2.com/?KeepItSimple). | ||||
| @@ -280,16 +312,19 @@ The files in this volume should be owned by the factorio user, uid 845. | ||||
|  | ||||
| [Docker Compose](https://docs.docker.com/compose/install/) is an easy way to run Docker containers. | ||||
|  | ||||
| First get a [docker-compose.yml](https://github.com/factoriotools/factorio-docker/blob/master/0.17/docker-compose.yml) file. To get it from this repository: | ||||
| * docker-engine >= 1.10.0 is required | ||||
| * docker-compose >=1.6.0 is required | ||||
|  | ||||
| First get a [docker-compose.yml](https://github.com/factoriotools/factorio-docker/blob/master/docker/docker-compose.yml) file. To get it from this repository: | ||||
|  | ||||
| ```shell | ||||
| git clone https://github.com/factoriotools/factorio-docker.git | ||||
| cd docker_factorio_server/0.17 | ||||
| cd factorio-docker/docker | ||||
| ``` | ||||
|  | ||||
| Or make your own: | ||||
|  | ||||
| ```shell | ||||
| ```yaml | ||||
| version: '2' | ||||
| services: | ||||
|   factorio: | ||||
| @@ -311,14 +346,14 @@ sudo docker-compose up -d | ||||
|  | ||||
| ### Ports | ||||
|  | ||||
| * `34197/udp` - Game server (required). | ||||
| * `34197/udp` - Game server (required). This can be changed with the `PORT` environment variable. | ||||
| * `27015/tcp` - RCON (optional). | ||||
|  | ||||
| ## LAN Games | ||||
|  | ||||
| Ensure the `lan` setting in server-settings.json is `true`. | ||||
|  | ||||
| ```shell | ||||
| ```json | ||||
|   "visibility": | ||||
|   { | ||||
|     "public": false, | ||||
| @@ -335,7 +370,7 @@ sudo docker run -d \ | ||||
|   -p 27015:27015/tcp \ | ||||
|   -v /opt/factorio:/factorio \ | ||||
|   --name factorio \ | ||||
|   --restart=always  \ | ||||
|   --restart=unless-stopped  \ | ||||
|   factoriotools/factorio | ||||
| ``` | ||||
|  | ||||
| @@ -356,6 +391,21 @@ For LAN games the VM needs an internal IP in order for clients to connect. One w | ||||
|  | ||||
| If you're looking for a simple way to deploy this to the Amazon Web Services Cloud, check out the [Factorio Server Deployment (CloudFormation) repository](https://github.com/m-chandler/factorio-spot-pricing). This repository contains a CloudFormation template that will get you up and running in AWS in a matter of minutes. Optionally it uses Spot Pricing so the server is very cheap, and you can easily turn it off when not in use. | ||||
|  | ||||
| ## Using a reverse proxy | ||||
|  | ||||
| If you need to use a reverse proxy you can use the following nginx snippet: | ||||
|  | ||||
| ``` | ||||
| stream { | ||||
|   server { | ||||
|       listen 34197 udp reuseport; | ||||
|       proxy_pass my.upstream.host:34197; | ||||
|   } | ||||
| } | ||||
| ``` | ||||
|  | ||||
| If your factorio host uses multiple IP addresses (very common with IPv6), you might additionally need to bind Factorio to a single IP (otherwise the UDP proxy might get confused with IP mismatches). To do that pass the `BIND` envvar to the container: `docker run --network=host -e BIND=2a02:1234::5678 ...` | ||||
|  | ||||
| ## Troubleshooting | ||||
|  | ||||
| ### My server is listed in the server browser, but nobody can connect | ||||
| @@ -378,7 +428,12 @@ Use the `PORT` environment variable to start the server on the a different port, | ||||
| * [DBendit](https://github.com/DBendit/docker_factorio_server) - Coded admin list, ban list support and contributed version updates | ||||
| * [Zopanix](https://github.com/zopanix/docker_factorio_server) - Original Author | ||||
| * [Rfvgyhn](https://github.com/Rfvgyhn/docker-factorio) - Coded randomly generated RCON password | ||||
| * [gnomus](https://github.com/gnomus/docker_factorio_server) - Coded wite listing support | ||||
| * [gnomus](https://github.com/gnomus/docker_factorio_server) - Coded white listing support | ||||
| * [bplein](https://github.com/bplein/docker_factorio_server) - Coded scenario support | ||||
| * [jaredledvina](https://github.com/jaredledvina/docker_factorio_server) - Contributed version updates | ||||
| * [carlbennett](https://github.com/carlbennett) - Contributed version updates and bugfixes | ||||
|  | ||||
| [^1]: Space Age mods can also be individually enabled by using their name separated by space.   | ||||
|   Example 1: Enable all by using `true` | ||||
|   Example 2: Enable all by listing the mod names `space-age elevated-rails quality`   | ||||
|   Example 3: Enable only Elevated rails `elevated-rails` | ||||
|   | ||||
							
								
								
									
										395
									
								
								README_zh_CN.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										395
									
								
								README_zh_CN.md
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,395 @@ | ||||
| # Factorio-异星工厂 [](https://travis-ci.org/factoriotools/factorio-docker)  [](https://hub.docker.com/r/factoriotools/factorio/) [](https://hub.docker.com/r/factoriotools/factorio/) [](https://hub.docker.com/r/factoriotools/factorio/) [](https://microbadger.com/images/factoriotools/factorio "Get your own image badge on microbadger.com") | ||||
|  | ||||
| 版本信息可以在[这里](https://github.com/factoriotools/factorio-docker/blob/master/README.md#factorio------)找到 | ||||
|  | ||||
| ## 标签描述 | ||||
|  | ||||
| * `latest` - 最新版本 (可能含有实验性功能). | ||||
| * `stable` - 最新的稳定版本 [factorio.com](https://www.factorio.com). | ||||
| * `0.x`    - 某个分支上的最新版本 | ||||
| * `0.x.y` - 具体的版本 | ||||
| * `0.x-z` - 在该版本上的增量更新 | ||||
|  | ||||
| ## 什么是 Facotrio? | ||||
|  | ||||
| > 摘录自 [steam factorio 页面](https://store.steampowered.com/app/427520/Factorio/) | ||||
|  | ||||
| 「异星工厂」Factorio 是一款建造工业生产流水线并保持其高效运转的游戏。 | ||||
|  | ||||
| 在游戏中,你可以抠矿、搞科研、盖工厂、建设自动生产流水线,同时还要与异星虫子们互相伤害。 | ||||
|  | ||||
| 你将从一无所有艰辛起步。挥斧砍树,抡镐抠矿,手搓机械臂和传送带,然而像这样一直搞下去并没有什么卵用。因此,你需要高效的大规模发电厂,庞大的石油化工体系,壮观的全自动化产业链,以及替你东奔西走的机器人大队,让你成为物资储备丰盈工业帝国的真正操控者! | ||||
|  | ||||
| 然而,总有一群刁民想害你。这个星球上的土著虫群对你在自家后院里瞎折腾的行为很不爽,总有一天这群刁民会联合起来找你麻烦。因此,你要制造武器、建立防御、准备镇压,让它们知道谁才是真正的主宰者。 | ||||
|  | ||||
| 你可以在多人游戏中加入不同的阵营,在大触们的带领下与朋友们分工协作, 一起建设恢弘无比的工业园区。 | ||||
|  | ||||
| Factorio的模组支持吸引了全世界的设计师参与到对游戏的完善和革新中来,从优化调整到游戏辅助,甚至对游戏的彻底翻新,日新月异的模组将为你不断提供新的乐趣。 | ||||
| 除了游戏核心的自由模式和沙盒模式之外,任务包还提供了更多不同形式的游戏挑战,这已经作为一个免费的DLC提供给玩家了。 | ||||
|  | ||||
| 对随机生成的地图不满意?不满足于原生游戏任务?这都不是事儿。通过内置的地图编辑器,你可以任意修改地图,配置地形、建筑、敌人等各种元素。如果你是大触,还可以添加自定义脚本,让你的游戏更具独创性、更加阴吹思婷! | ||||
|  | ||||
| **注意**:这个仓库仅包含游戏服务端. 游戏本体可以在 [factorio.com](factorio.com)、 [Steam](https://store.steampowered.com/app/427520/Factorio/)、[GOG.com](https://www.gog.com/game/factorio) 和 [Humble Bundle](https://www.humblebundle.com/store/factorio) 上找到。 | ||||
|  | ||||
| ## 使用方法 | ||||
|  | ||||
| ### 快速入门 | ||||
|  | ||||
| 运行服务端以在指定目录下生成必要的配置文件以及存档,`/opt/factorio` 也许是一个不错的选择。 | ||||
|  | ||||
| ```shell | ||||
| sudo mkdir -p /opt/factorio | ||||
| sudo chown 845:845 /opt/factorio | ||||
| sudo docker run -d \ | ||||
|   -p 34197:34197/udp \ | ||||
|   -p 27015:27015/tcp \ | ||||
|   -v /opt/factorio:/factorio \ | ||||
|   --name factorio \ | ||||
|   --restart=always \ | ||||
|   factoriotools/factorio | ||||
| ``` | ||||
|  | ||||
| 这样一来, 服务端会使用 `/opt/factorio/saves` 中最新的存档进行游戏。 | ||||
|  | ||||
| 你一定想知道上面那些咒语是什么意思: | ||||
|  | ||||
| * `-d` - 以守护进程方式运行 ("detached")。 | ||||
| * `-p` - 暴露宿主机 (host) 某些端口。 | ||||
| * `-v` - 将宿主机中 `/opt/factorio` 目录挂载到docker容器的 `/factorio` 目录。 | ||||
| * `--restart` - 在宿主重启或服务端运行崩溃后重启服务端。 | ||||
| * `--name` - 将docker容器命名为 "factorio" (否则docker会给他随机起一个搞怪名字)。 | ||||
|  | ||||
| `chown` 命令用来更改服务端所在目录的所有权用户以及用户组,为了安全起见我们并不希望游戏直接在root用户权限下运行,因此将用户id更改为845,从而服务端允许该用户在目录中进行读、写、运行操作。 | ||||
|  | ||||
| 查看日志以搞清楚发生了什么。 | ||||
|  | ||||
| ```shell | ||||
| docker logs factorio | ||||
| ``` | ||||
|  | ||||
| 停止docker容器 (服务端)。 | ||||
|  | ||||
| ```shell | ||||
| docker stop factorio | ||||
| ``` | ||||
|  | ||||
| 在运行过服务端之后可以在 `/opt/factorio/config` 目录中找到 `server-settings.json` 文件,修改改文件以定制你自己的服务端。 | ||||
|  | ||||
| ```shell | ||||
| docker start factorio | ||||
| ``` | ||||
|  | ||||
| 现在试试连接服务端。如果没有正常运行的话请按照上面步骤查看日志。 | ||||
|  | ||||
| ### Console-终端 | ||||
|  | ||||
| 为了运行在服务端终端中运行命令,需要通过 `-it` 参数在交互模式下启动服务端。通过 `docker attach` 连接终端从而可以输入命令。 | ||||
|  | ||||
| ```shell | ||||
| docker run -d -it \ | ||||
|   --name factorio \ | ||||
|   factoriotools/factorio | ||||
|    | ||||
| docker attach factorio | ||||
| ``` | ||||
|  | ||||
| ### 升级服务端 | ||||
|  | ||||
| 在升级服务端之前请务必**备份存档**,在客户端(也就是你的游戏中)备份存档相当容易(保存就好)。 | ||||
|  | ||||
| 请确保在启动服务端时使用了 `-v` 参数,从而服务端将会把存档写在你指定的挂在目录中。`docker rm` 命令会彻底删除运行 facotrio 服务端的容器,也同时会删除容器的整个文件系统实例,因此如果没有挂载外部目录的话,存档也会被删除哦。 | ||||
|  | ||||
| ```shell | ||||
| docker stop factorio | ||||
| docker rm factorio | ||||
| docker pull factoriotools/factorio | ||||
| ``` | ||||
|  | ||||
| 然后就像前面说的那样启动服务端,大概一分钟后新的服务端就已经在运行中啦,并且存档和设置还和原来一样! | ||||
|  | ||||
| ### 存档 | ||||
|  | ||||
| 在第一次运行服务端的时候,服务端会根据 `/opt/factorio/config` 目录中的 `map-gen-settings.json` 和 `map-settings.json` 配置文件的内容,在 `/opt/factorio/saves` 目录下会生成一张新地图(存档)`_autosave1.zip`。之后如果在停掉之后再次运行,服务端会载入最新的存档。 | ||||
|  | ||||
| 如果想要运行一个旧存档,你需要停止运行中的服务端,并且运行一个命令 `touch oldsave.zip`。 这会重置其日期,然后重新启动服务端。或者你可以通过删除所有其他存档只留下想要运行的存档来完成同样的目的。 | ||||
|  | ||||
| 如果想生成一个新的存档,你需要停止运行中的服务端,然后删除所有的存档再启动服务端就好。 | ||||
|  | ||||
| #### 在运行命令中直接指定存档(需要 0.17.79-2+ 版本) | ||||
|  | ||||
| 你可以在启动服务端时通过设置一个特殊的环境变量来载入一个特定的存档: | ||||
|  | ||||
| 设置 `SAVE_NAME` 为 `saves` 中你想运行的存档名,去掉 `.zip` 后缀: | ||||
|  | ||||
| ```shell | ||||
| sudo docker run -d \ | ||||
|   -p 34197:34197/udp \ | ||||
|   -p 27015:27015/tcp \ | ||||
|   -v /opt/factorio:/factorio \ | ||||
|   -e LOAD_LATEST_SAVE=false \ | ||||
|   -e SAVE_NAME=replaceme \ | ||||
|   --name factorio \ | ||||
|   --restart=always \ | ||||
|   factoriotools/factorio | ||||
| ``` | ||||
|  | ||||
| 若要生成一个新存档,设置 `GENERATE_NEW_SAVE=true`,同时指定存档名 `SAVE_NAME`: | ||||
|  | ||||
| ```shell | ||||
| sudo docker run -d \ | ||||
|   -p 34197:34197/udp \ | ||||
|   -p 27015:27015/tcp \ | ||||
|   -v /opt/factorio:/factorio \ | ||||
|   -e LOAD_LATEST_SAVE=false \ | ||||
|   -e GENERATE_NEW_SAVE=true \ | ||||
|   -e SAVE_NAME=replaceme \ | ||||
|   --name factorio \ | ||||
|   --restart=always \ | ||||
|   factoriotools/factorio | ||||
| ``` | ||||
|  | ||||
| ### Mods-模组 | ||||
|  | ||||
| 将模组拷贝至 `mods` 目录下,然后重启服务端即可。 | ||||
|  | ||||
| 对于 `0.17` 及以上版本,新增 `UPDATE_MODES_ON_START` 环境变量,如果将其设置为 `true`,在服务端启动时将会更新所有的模组。请注意,应用此设置时,必须通过 docker secrets、环境变量或者在 `server-settings.json` 中填写相应字段来提供一个合法的 [Facotrio 用户名以及 Token](https://www.factorio.com/profile),否则服务端就不会启动。 | ||||
|  | ||||
| ### Scenarios-场景 | ||||
|  | ||||
| 如果你希望新启动一个场景(而不是从某一个存档中启动),你需要通过另一个备选 `entrypoint` 来启动我们的 factorio-docker 镜像:通过运行以下命令,使用 `/factorio/entrypoints` 目录中的示例 entrypoint 文件来启动服务端。仔细观察后就能发现这只是在之前的命令基础上增加了 `--entrypoint` 设置并在最后新增了一个参数用来指示 `scenarios` 目录中想要启动的场景的文件名。 | ||||
|  | ||||
|  | ||||
| ```shell | ||||
| docker run -d \ | ||||
|   -p 34197:34197/udp \ | ||||
|   -p 27015:27015/tcp \ | ||||
|   -v /opt/factorio:/factorio \ | ||||
|   --name factorio \ | ||||
|   --restart=always  \ | ||||
|   --entrypoint "/scenario.sh" \ | ||||
|   factoriotools/factorio \ | ||||
|   MyScenarioName | ||||
| ``` | ||||
|  | ||||
| ### 将场景转换为常规地图 | ||||
|  | ||||
| 如果你想把你的场景导出为一个常规的地图存档,类似启动一个新的场景,我们可以通过一个备选 `entrypoint` 文件来达到这个效果:服务端在运行后会将场景转换成一个常规地图存档放置在你的 `saves` 目录中,然后你就可以像平常那样启动服务端了。 | ||||
|  | ||||
| ```shell | ||||
| docker run -d \ | ||||
|   -p 34197:34197/udp \ | ||||
|   -p 27015:27015/tcp \ | ||||
|   -v /opt/factorio:/factorio \ | ||||
|   --name factorio \ | ||||
|   --restart=always  \ | ||||
|   --entrypoint "/scenario2map.sh" \ | ||||
|   factoriotools/factorio | ||||
|   MyScenarioName | ||||
| ``` | ||||
|  | ||||
| ### RCON | ||||
|  | ||||
| 在 config/rconpw 文件中设置RCON密码。 如果 rconpw 文件不存在,将会自动生成含有随机密码的该文件。 | ||||
|  | ||||
| 如果想要更改密码,请停止服务端,编辑rconpw文件并重启服务端。 | ||||
|  | ||||
| 如果想要禁用RCON,请不要在启动命令中加入 -p 27015:27015/tcp 参数,在宿主机(服务器)中停止暴露rcon端口,这时,RCON将继续在docker容器中运行,但不可达。 | ||||
|  | ||||
|  | ||||
| ### 白名单 (0.15.3+) | ||||
|  | ||||
| 创建文件 `config/server-whitelist.json` 然后将用户名加入到该json中。 | ||||
|  | ||||
| ```json | ||||
| [ | ||||
|     "you", | ||||
|     "friend" | ||||
| ] | ||||
| ``` | ||||
|  | ||||
| ### 黑名单 (0.17.1+) | ||||
|  | ||||
| 创建文件 `config/server-banlist.json` 然后将用户名加入到该json中。 | ||||
|  | ||||
| ```json | ||||
| [ | ||||
|     "bad_person", | ||||
|     "other_bad_person" | ||||
| ] | ||||
| ``` | ||||
|  | ||||
| ### 管理员列表 (0.17.1+) | ||||
|  | ||||
| 创建文件 `config/server-adminlist.json` 然后将用户名加入到该json中。 | ||||
|  | ||||
| ```json | ||||
| [ | ||||
|     "you", | ||||
|     "friend" | ||||
| ] | ||||
| ``` | ||||
|  | ||||
| ### 自定义配置文件 (0.17.x+) | ||||
|  | ||||
| 原始的 factorio 服务端并不支持在配置文件中添加环境变量,这里提供一个变通办法:通过在 docker-compose 中使用 `envsubst` 命令,在服务端启动时根据环境变量来动态生成配置文件: | ||||
|  | ||||
| 下面的例子将用相应的环境变量来填充 `server-settings.json` 中的字段。 | ||||
|  | ||||
| ```yaml | ||||
| factorio_1: | ||||
|   image: factoriotools/factorio | ||||
|   ports: | ||||
|     - "34197:34197/udp" | ||||
|   volumes: | ||||
|    - /opt/factorio:/factorio | ||||
|    - ./server-settings.json:/server-settings.json | ||||
|   environment: | ||||
|     - INSTANCE_NAME=Your Instance's Name | ||||
|     - INSTANCE_DESC=Your Instance's Description | ||||
|   entrypoint: /bin/sh -c "mkdir -p /factorio/config && envsubst < /server-settings.json > /factorio/config/server-settings.json && exec /docker-entrypoint.sh" | ||||
| ``` | ||||
|  | ||||
| `server-settings.json` 中可能提供一些供环境变量来替换的字段: | ||||
|  | ||||
| ```json | ||||
| "name": "${INSTANCE_NAME}", | ||||
| "description": "${INSTANCE_DESC}", | ||||
| ``` | ||||
|  | ||||
| ### 容器相关的细节 | ||||
|  | ||||
| [保持简单](http://wiki.c2.com/?KeepItSimple)的哲学。 | ||||
|  | ||||
| + 服务端应当可以自启动 | ||||
| + 在环境变量和配置文件中倾向于配置文件 | ||||
| + 只使用一个数据卷(挂载目录) | ||||
|  | ||||
| ### 数据卷 | ||||
|  | ||||
| 为了保持简单,我们的 docker 服务端只使用一个数据卷挂载到容器中的 `/factorio` 目录。其中包含了所有的配置,模组和存档。 | ||||
|  | ||||
| 在这个数据卷中所有的文件应当被 uid 为 845 的 factorio 专有用户所拥有(为了安全) | ||||
|  | ||||
| ```text | ||||
|   factorio | ||||
|   |-- config | ||||
|   |   |-- map-gen-settings.json | ||||
|   |   |-- map-settings.json | ||||
|   |   |-- rconpw | ||||
|   |   |-- server-adminlist.json | ||||
|   |   |-- server-banlist.json | ||||
|   |   |-- server-settings.json | ||||
|   |   `-- server-whitelist.json | ||||
|   |-- mods | ||||
|   |   `-- fancymod.zip | ||||
|   `-- saves | ||||
|       `-- _autosave1.zip | ||||
| ``` | ||||
|  | ||||
| ### Docker Compose | ||||
|  | ||||
| [Docker Compose](https://docs.docker.com/compose/install/) 提供了一种便捷的容器运行方式。 | ||||
|  | ||||
| 首先获取一个 [docker-compose.yml](https://github.com/factoriotools/factorio-docker/blob/master/0.17/docker-compose.yml) 文件。假设你准备使用我们提供的: | ||||
|  | ||||
| ```shell | ||||
| git clone https://github.com/factoriotools/factorio-docker.git | ||||
| cd docker_factorio_server/0.17 | ||||
| ``` | ||||
|  | ||||
| 或者假设你想自己编写一个: | ||||
|  | ||||
| ```shell | ||||
| version: '2' | ||||
| services: | ||||
|   factorio: | ||||
|     image: factoriotools/factorio | ||||
|     ports: | ||||
|      - "34197:34197/udp" | ||||
|      - "27015:27015/tcp" | ||||
|     volumes: | ||||
|      - /opt/factorio:/factorio | ||||
| ``` | ||||
|  | ||||
| 现在通过 cd 命令进入到 `docker-compose.yml` 所在的目录然后运行下面的命令: | ||||
|  | ||||
| ```shell | ||||
| sudo mkdir -p /opt/factorio | ||||
| sudo chown 845:845 /opt/factorio | ||||
| sudo docker-compose up -d | ||||
| ``` | ||||
|  | ||||
| ### 端口 | ||||
|  | ||||
| - `34197/udp` - 游戏服务端(必要)。可以通过改变 `PORT` 环境变量来改变。 | ||||
| - `27015/tcp` - RCON(可选)。 | ||||
|  | ||||
| ## 局域网游戏 | ||||
|  | ||||
| 确保 `server-settings.json` 中的 `lan` 字段被设置为 `true`。 | ||||
|  | ||||
| ```shell | ||||
|   "visibility": | ||||
|   { | ||||
|     "public": false, | ||||
|     "lan": true | ||||
|   }, | ||||
| ``` | ||||
|  | ||||
| 在启动服务端时假如 `--network=host` 参数,从而客户端可以自动找到局域网游戏,参考 快速入门 章节。 | ||||
|  | ||||
| ```shell | ||||
| sudo docker run -d \ | ||||
|   --network=host \ | ||||
|   -p 34197:34197/udp \ | ||||
|   -p 27015:27015/tcp \ | ||||
|   -v /opt/factorio:/factorio \ | ||||
|   --name factorio \ | ||||
|   --restart=always  \ | ||||
|   factoriotools/factorio | ||||
| ``` | ||||
|  | ||||
| ## 在其他平台上部署 | ||||
|  | ||||
| ### Vagrant | ||||
|  | ||||
| [Vagrant](https://www.vagrantup.com/) 是一种通过虚拟机来运行 Docker 的便捷方式。 在 [Factorio Vagrant box repository](https://github.com/dtandersen/factorio-lan-vagrant) 中有一个示例的 Vagrantfile。 | ||||
|  | ||||
| 对于局域网游戏,Vagrant 虚拟机需要一个内部 IP 从而使游戏可达。一种方式是通过在一个空开网络中部署。虚拟机使用 DHCP 方式来获取一个 IP 地址。同时必须转发到 34197 端口。 | ||||
|  | ||||
| ```ruby | ||||
|   config.vm.network "public_network" | ||||
|   config.vm.network "forwarded_port", guest: 34197, host: 34197 | ||||
| ``` | ||||
|  | ||||
| ### AWS 部署 | ||||
|  | ||||
| 如果你想找一个傻瓜教程,请看这个[仓库](https://github.com/m-chandler/factorio-spot-pricing)。这个仓库中包含一个可以让你在几分钟内在 AWS 上搭建服务端的 CloudFormation 模板。同时它支持 Spot Pricing 因此费用会非常便宜,而且你可以在不用的时候把服务器关掉。 | ||||
|  | ||||
| ## 疑难杂症 | ||||
|  | ||||
| ### 我可以在服务器列表中看到我的服务器但就是无法连接 | ||||
|  | ||||
| 查看 log,如果有一行说 `Own address is RIGHT IP:WRONG PORT`,那么这个问题就有可能是 Docker Proxy 导致的。 如果 IP 和端口都是正确的,那么有可能是端口转发或者防火墙出了问题。 | ||||
|  | ||||
| 在默认情况下,Docker 通过一个代理来转发网络请求。这个代理会改变 UDP 端口,因此会监测到上面的端口错误。更多细节请移步 *[Incorrect port detected for docker hosted server](https://forums.factorio.com/viewtopic.php?f=49&t=35255)*。 | ||||
|  | ||||
| 为了修复错误端口问题,在启动 Docker 服务时加上 `--userland-proxy=false`。这样一来 Docker 就会通过 iptables 来转发请求从而不走代理。可以通过设置 `DOCKER_OPTS` 环境变量或者改变 Docker systemd service 中的 `ExecStart` 字段来添加这一参数。不同的操作系统可能有不同的配置方式。 | ||||
|  | ||||
| ### 我不用 34197 端口就没人可以连我的服务器 | ||||
|  | ||||
| 如果一定要改端口,请使用 `PORT` 环境变量更改。例如 `docker run -e PORT=34198`。这样会更改端口监测中的目标端口。通过 `-p 34198:34197` 方式更改端口对于私人服务器来说是可行的,但这样一来服务器浏览器就没有办法检测到正确的端口了。 | ||||
|  | ||||
| ## 贡献者 | ||||
|  | ||||
| * [dtandersen](https://github.com/dtandersen) - Maintainer | ||||
| * [Fank](https://github.com/Fankserver) - Programmer of the Factorio watchdog that keeps the version up-to-date. | ||||
| * [SuperSandro2000](https://github.com/supersandro2000) - CI Guy, Maintainer and runner of the Factorio watchdog. Contributed version updates and wrote the Travis scripts. | ||||
| * [DBendit](https://github.com/DBendit/docker_factorio_server) - Coded admin list, ban list support and contributed version updates | ||||
| * [Zopanix](https://github.com/zopanix/docker_factorio_server) - Original Author | ||||
| * [Rfvgyhn](https://github.com/Rfvgyhn/docker-factorio) - Coded randomly generated RCON password | ||||
| * [gnomus](https://github.com/gnomus/docker_factorio_server) - Coded wite listing support | ||||
| * [bplein](https://github.com/bplein/docker_factorio_server) - Coded scenario support | ||||
| * [jaredledvina](https://github.com/jaredledvina/docker_factorio_server) - Contributed version updates | ||||
| * [carlbennett](https://github.com/carlbennett) - Contributed version updates and bugfixes | ||||
| * [Thrimbda](https://github.com/Thrimbda) - 中文翻译 | ||||
							
								
								
									
										109
									
								
								build.py
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										109
									
								
								build.py
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,109 @@ | ||||
| #!/usr/bin/env python3 | ||||
|  | ||||
| import os | ||||
| import json | ||||
| import subprocess | ||||
| import shutil | ||||
| import sys | ||||
| import tempfile | ||||
|  | ||||
|  | ||||
| PLATFORMS = [ | ||||
|     "linux/arm64", | ||||
|     "linux/amd64", | ||||
| ] | ||||
|  | ||||
|  | ||||
| def create_builder(build_dir, builder_name, platform): | ||||
|     check_exists_command = ["docker", "buildx", "inspect", builder_name] | ||||
|     if subprocess.run(check_exists_command, stderr=subprocess.DEVNULL).returncode != 0: | ||||
|         create_command = ["docker", "buildx", "create", "--platform", platform, "--name", builder_name] | ||||
|         try: | ||||
|             subprocess.run(create_command, cwd=build_dir, check=True) | ||||
|         except subprocess.CalledProcessError: | ||||
|             print("Creating builder failed") | ||||
|             exit(1) | ||||
|  | ||||
|  | ||||
| def build_and_push_multiarch(build_dir, build_args, push): | ||||
|     builder_name = "factoriotools-multiarch" | ||||
|     platform=",".join(PLATFORMS) | ||||
|     create_builder(build_dir, builder_name, platform) | ||||
|     build_command = ["docker", "buildx", "build", "--platform", platform, "--builder", builder_name] + build_args | ||||
|     if push: | ||||
|         build_command.append("--push") | ||||
|     try: | ||||
|         subprocess.run(build_command, cwd=build_dir, check=True) | ||||
|     except subprocess.CalledProcessError: | ||||
|         print("Build and push of image failed") | ||||
|         exit(1) | ||||
|  | ||||
|  | ||||
| def build_singlearch(build_dir, build_args): | ||||
|     build_command = ["docker", "build"] + build_args | ||||
|     try: | ||||
|         subprocess.run(build_command, cwd=build_dir, check=True) | ||||
|     except subprocess.CalledProcessError: | ||||
|         print("Build of image failed") | ||||
|         exit(1) | ||||
|  | ||||
|  | ||||
| def push_singlearch(tags): | ||||
|     for tag in tags: | ||||
|         try: | ||||
|             subprocess.run(["docker", "push", f"factoriotools/factorio:{tag}"], | ||||
|                             check=True) | ||||
|         except subprocess.CalledProcessError: | ||||
|             print("Docker push failed") | ||||
|             exit(1) | ||||
|  | ||||
|  | ||||
| def build_and_push(sha256, version, tags, push, multiarch): | ||||
|     build_dir = tempfile.mktemp() | ||||
|     shutil.copytree("docker", build_dir) | ||||
|     build_args = ["--build-arg", f"VERSION={version}", "--build-arg", f"SHA256={sha256}", "."] | ||||
|     for tag in tags: | ||||
|         build_args.extend(["-t", f"factoriotools/factorio:{tag}"]) | ||||
|     if multiarch: | ||||
|         build_and_push_multiarch(build_dir, build_args, push) | ||||
|     else: | ||||
|         build_singlearch(build_dir, build_args) | ||||
|         if push: | ||||
|             push_singlearch(tags) | ||||
|  | ||||
|  | ||||
| def login(): | ||||
|     try: | ||||
|         username = os.environ["DOCKER_USERNAME"] | ||||
|         password = os.environ["DOCKER_PASSWORD"] | ||||
|         subprocess.run(["docker", "login", "-u", username, "-p", password], check=True) | ||||
|     except KeyError: | ||||
|         print("Username and password need to be given") | ||||
|         exit(1) | ||||
|     except subprocess.CalledProcessError: | ||||
|         print("Docker login failed") | ||||
|         exit(1) | ||||
|  | ||||
|  | ||||
| def main(push_tags=False, multiarch=False): | ||||
|     with open(os.path.join(os.path.dirname(__file__), "buildinfo.json")) as file_handle: | ||||
|         builddata = json.load(file_handle) | ||||
|  | ||||
|     if push_tags: | ||||
|         login() | ||||
|  | ||||
|     for version, buildinfo in sorted(builddata.items(), key=lambda item: item[0], reverse=True): | ||||
|         sha256 = buildinfo["sha256"] | ||||
|         tags = buildinfo["tags"] | ||||
|         build_and_push(sha256, version, tags, push_tags, multiarch) | ||||
|  | ||||
|  | ||||
| if __name__ == '__main__': | ||||
|     push_tags = False | ||||
|     multiarch = False | ||||
|     for arg in sys.argv[1:]: | ||||
|         if arg == "--push-tags": | ||||
|             push_tags = True | ||||
|         elif arg == "--multiarch": | ||||
|             multiarch = True | ||||
|     main(push_tags, multiarch) | ||||
| @@ -16,19 +16,21 @@ cd "$VERSION_SHORT" || exit 1 | ||||
| VERSION=$(grep -oP '[0-9]+\.[0-9]+\.[0-9]+' Dockerfile | head -1) | ||||
| DOCKER_REPO=factoriotools/factorio | ||||
| 
 | ||||
| if [[ ${TRAVIS_PULL_REQUEST:-} == true ]]; then | ||||
|   TAGS="$DOCKER_REPO:$TRAVIS_PULL_REQUEST_SLUG" | ||||
| BRANCH=${GITHUB_REF#refs/*/} | ||||
| 
 | ||||
| if [[ -n ${GITHUB_BASE_REF:-} ]]; then | ||||
|   TAGS="-t $DOCKER_REPO:$GITHUB_BASE_REF" | ||||
| else | ||||
|   if [[ -n ${CI:-} ]]; then | ||||
|     # we are either on master or on a tag build | ||||
|     if [[ ${TRAVIS_BRANCH:-} == master || ${TRAVIS_BRANCH:-} == "$VERSION" ]]; then | ||||
|     if [[ ${BRANCH:-} == master || ${BRANCH:-} == "$VERSION" ]]; then | ||||
|       TAGS="-t $DOCKER_REPO:$VERSION -t $DOCKER_REPO:$VERSION_SHORT" | ||||
|     # we are on an incremental build of a tag | ||||
|     elif [[ $VERSION == "${TRAVIS_BRANCH%-*}" ]]; then | ||||
|       TAGS="-t $DOCKER_REPO:$TRAVIS_BRANCH -t $DOCKER_REPO:$VERSION -t $DOCKER_REPO:$VERSION_SHORT" | ||||
|     elif [[ $VERSION == "${BRANCH%-*}" ]]; then | ||||
|       TAGS="-t $DOCKER_REPO:$BRANCH -t $DOCKER_REPO:$VERSION -t $DOCKER_REPO:$VERSION_SHORT" | ||||
|     # we build a other branch than master and exclude dependabot branches from tags cause the / is not supported by docker | ||||
|     elif [[ -n ${TRAVIS_BRANCH:-} && ! $TRAVIS_BRANCH =~ "/" ]]; then | ||||
|       TAGS="-t $DOCKER_REPO:$TRAVIS_BRANCH" | ||||
|     elif [[ -n ${BRANCH:-} && ! $BRANCH =~ "/" ]]; then | ||||
|       TAGS="-t $DOCKER_REPO:$BRANCH" | ||||
|     fi | ||||
|   else | ||||
|     # we are not in CI and tag version and version short | ||||
| @@ -47,19 +49,24 @@ else | ||||
|   fi | ||||
| fi | ||||
| 
 | ||||
| # Travis gets rate limited by Docker HUB. | ||||
| if [[ ${CI:-} == true && -n ${DOCKER_PASSWORD:-} && -n ${DOCKER_USERNAME:-} ]]; then | ||||
|   echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin | ||||
| fi | ||||
| 
 | ||||
| # shellcheck disable=SC2068 | ||||
| eval docker build . ${TAGS[@]:-} | ||||
| docker images | ||||
| 
 | ||||
| # remove -1 from incremental tag | ||||
| # eg before: 0.18.24-1, after 0.18.24 | ||||
| if [[ ${TRAVIS_BRANCH:-} ]]; then | ||||
|   TRAVIS_BRANCH_VERSION=${TRAVIS_BRANCH%-*} | ||||
| if [[ ${BRANCH:-} ]]; then | ||||
|   BRANCH_VERSION=${BRANCH%-*} | ||||
| fi | ||||
| 
 | ||||
| # only push when: | ||||
| # or we build a tag and we don't build a PR | ||||
| if [[ $VERSION == "${TRAVIS_BRANCH_VERSION:-}" && ${TRAVIS_PULL_REQUEST_BRANCH:-} == "" ]] || | ||||
| if [[ $VERSION == "${BRANCH_VERSION:-}" && ${GITHUB_BASE_REF:-} == "" ]] || | ||||
|   # or we are not in CI | ||||
|   [[ -z ${CI:-} ]]; then | ||||
| 
 | ||||
| @@ -68,18 +75,18 @@ if [[ $VERSION == "${TRAVIS_BRANCH_VERSION:-}" && ${TRAVIS_PULL_REQUEST_BRANCH:- | ||||
|   fi | ||||
| 
 | ||||
|   # push a tag on a branch other than master except dependabot branches cause docker does not support / | ||||
|   if [[ -n ${TRAVIS_BRANCH:-} && $VERSION != "${TRAVIS_BRANCH_VERSION:-}" && ${TRAVIS_BRANCH:-} != "master" && ! ${TRAVIS_BRANCH:-} =~ "/" ]]; then | ||||
|     docker push "$DOCKER_REPO:$TRAVIS_BRANCH" | ||||
|   if [[ -n ${BRANCH:-} && $VERSION != "${BRANCH_VERSION:-}" && ${BRANCH:-} != "master" && ! ${BRANCH:-} =~ "/" ]]; then | ||||
|     docker push "$DOCKER_REPO:$BRANCH" | ||||
|   fi | ||||
| 
 | ||||
|   # push an incremental tag | ||||
|   # eg 0.18.24-1 | ||||
|   if [[ $VERSION == "${TRAVIS_BRANCH_VERSION:-}" ]]; then | ||||
|     docker push "$DOCKER_REPO:$TRAVIS_BRANCH" | ||||
|   if [[ $VERSION == "${BRANCH_VERSION:-}" ]]; then | ||||
|     docker push "$DOCKER_REPO:$BRANCH" | ||||
|   fi | ||||
| 
 | ||||
|   # only push on tags or when manually running the script | ||||
|   if [[ -n ${TRAVIS_TAG:-} || -z ${CI:-} ]]; then | ||||
|   if [[ -n ${BRANCH_VERSION:-} || -z ${CI:-} ]]; then | ||||
|     docker push "$DOCKER_REPO:$VERSION" | ||||
|     docker push "$DOCKER_REPO:$VERSION_SHORT" | ||||
|   fi | ||||
| @@ -94,6 +101,4 @@ if [[ $VERSION == "${TRAVIS_BRANCH_VERSION:-}" && ${TRAVIS_PULL_REQUEST_BRANCH:- | ||||
|   if [[ ${STABLE:-} == "$VERSION" ]]; then | ||||
|     docker push "$DOCKER_REPO:stable" | ||||
|   fi | ||||
| 
 | ||||
|   curl -X POST https://hooks.microbadger.com/images/factoriotools/factorio/TmmKGNp8jKcFqZvcJhTCIAJVluw= | ||||
| fi | ||||
							
								
								
									
										77
									
								
								buildinfo.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										77
									
								
								buildinfo.json
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,77 @@ | ||||
| { | ||||
|   "0.12.35": { | ||||
|     "sha256": "ab9cf01a56dde3073aaaa5152c628bbf9a5bb85638b87dc3d7fdb77fb169aedd", | ||||
|     "tags": [ | ||||
|       "0.12.35", | ||||
|       "0.12" | ||||
|     ] | ||||
|   }, | ||||
|   "0.13.20": { | ||||
|     "sha256": "cbf5481e4b7e0efcc07c7b6a1fc3ff1404ad5597f3c9d37914a52ffb58d7c159", | ||||
|     "tags": [ | ||||
|       "0.13.20", | ||||
|       "0.13" | ||||
|     ] | ||||
|   }, | ||||
|   "0.14.23": { | ||||
|     "sha256": "96c3e7acd4e0f066a499baba01823cac7c1caf0e50dbddcea5793f57bd60dc8c", | ||||
|     "tags": [ | ||||
|       "0.14.23", | ||||
|       "0.14" | ||||
|     ] | ||||
|   }, | ||||
|   "0.15.40": { | ||||
|     "sha256": "1041ef61ea4aecd1f425e6030a909f0c349a9c01d1b3324d84a61b1cfef5ba6c", | ||||
|     "tags": [ | ||||
|       "0.15.40", | ||||
|       "0.15" | ||||
|     ] | ||||
|   }, | ||||
|   "0.16.51": { | ||||
|     "sha256": "6cb09f5ac87f16f8d5b43cef26c0ae26cc46a57a0382e253dfda032dc5bb367f", | ||||
|     "tags": [ | ||||
|       "0.16.51", | ||||
|       "0.16" | ||||
|     ] | ||||
|   }, | ||||
|   "0.17.79": { | ||||
|     "sha256": "9ace12fa986df028dc1851bf4de2cb038044d743e98823bc1c48ba21aa4d23df", | ||||
|     "tags": [ | ||||
|       "0.17.79", | ||||
|       "0.17" | ||||
|     ] | ||||
|   }, | ||||
|   "1.0.0": { | ||||
|     "sha256": "81d9e1aa94435aeec4131c8869fa6e9331726bea1ea31db750b65ba42dbd1464", | ||||
|     "tags": [ | ||||
|       "1.0.0", | ||||
|       "1.0" | ||||
|     ] | ||||
|   }, | ||||
|   "1.1.110": { | ||||
|     "sha256": "485fe6db36e5decd7dd0d70e7c97e61f818100fa3e48d87884b287027c7a646a", | ||||
|     "tags": [ | ||||
|       "stable-1.1.110", | ||||
|       "1", | ||||
|       "1.1", | ||||
|       "1.1.110" | ||||
|     ] | ||||
|   }, | ||||
|   "2.0.9": { | ||||
|     "sha256": "f499077b3e2c1313452c350f1faf17db31cae2a0fa738f69166e97c3caa3c86d", | ||||
|     "tags": [ | ||||
|       "stable", | ||||
|       "stable-2.0.9", | ||||
|       "2", | ||||
|       "2.0", | ||||
|       "2.0.9" | ||||
|     ] | ||||
|   }, | ||||
|   "2.0.10": { | ||||
|     "sha256": "2d7dd212fa6f715218a5e33bad7d593af8998fa7bf7ce727343159ee1f8c23f4", | ||||
|     "tags": [ | ||||
|       "latest", | ||||
|       "2.0.10" | ||||
|     ] | ||||
|   } | ||||
| } | ||||
							
								
								
									
										87
									
								
								docker/Dockerfile
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										87
									
								
								docker/Dockerfile
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,87 @@ | ||||
| FROM debian:stable-slim | ||||
|  | ||||
| LABEL maintainer="https://github.com/factoriotools/factorio-docker" | ||||
|  | ||||
| ARG USER=factorio | ||||
| ARG GROUP=factorio | ||||
| ARG PUID=845 | ||||
| ARG PGID=845 | ||||
| ARG BOX64_VERSION=v0.2.4 | ||||
|  | ||||
| # optionally utilize a built-in map-gen-preset (see data/base/prototypes/map-gen-presets | ||||
| # if this is used, the preset will be used over any .json files supplied | ||||
| # vanilla factorio provides the following presets: | ||||
| # rich-resources, marathon, death-world, death-world-marathon, rail-world, ribbon-world, island | ||||
| # a modded factorio example for using this: | ||||
| # space-exploration | ||||
| 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 \ | ||||
|     PUID="$PUID" \ | ||||
|     PGID="$PGID" \ | ||||
|     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/* | ||||
|  | ||||
| RUN addgroup --system --gid "$PGID" "$GROUP" \ | ||||
|     && adduser --system --uid "$PUID" --gid "$PGID" --no-create-home --disabled-password --shell /bin/sh "$USER" | ||||
|  | ||||
| # 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/ \ | ||||
|     && chown -R "$USER":"$GROUP" /opt/factorio /factorio | ||||
|  | ||||
| COPY files/*.sh / | ||||
| COPY files/config.ini /opt/factorio/config/config.ini | ||||
|  | ||||
| VOLUME /factorio | ||||
| EXPOSE $PORT/udp $RCON_PORT/tcp | ||||
| ENTRYPOINT ["/docker-entrypoint.sh"] | ||||
							
								
								
									
										24
									
								
								docker/docker-compose.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								docker/docker-compose.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,24 @@ | ||||
| version: '2' | ||||
| services: | ||||
|   factorio: | ||||
|     build: | ||||
|       context: . | ||||
|       args: | ||||
|         # Check buildinfo.json for supported versions and SHAs | ||||
|         # https://github.com/factoriotools/factorio-docker/blob/master/buildinfo.json | ||||
|         - VERSION=2.0.9 | ||||
|         - SHA256=f499077b3e2c1313452c350f1faf17db31cae2a0fa738f69166e97c3caa3c86d | ||||
|     ports: | ||||
|       - "34197:34197/udp" | ||||
|       - "27015:27015/tcp" | ||||
|     volumes: | ||||
|       - /opt/factorio:/factorio | ||||
| #    environment: | ||||
| #      - PUID=1000 | ||||
| #      - PGID=1000 | ||||
| #      - UPDATE_MODS_ON_START=true | ||||
| #      - USERNAME=FactorioUsername | ||||
| #      - TOKEN=FactorioToken | ||||
| #      - PORT=34198 | ||||
| #      - PRESET=deathworld | ||||
| #      - ADDR=::1 | ||||
							
								
								
									
										57
									
								
								docker/files/docker-dlc.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										57
									
								
								docker/files/docker-dlc.sh
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,57 @@ | ||||
| #!/bin/bash | ||||
| set -eou pipefail | ||||
|  | ||||
| # Path to the mod-list.json file | ||||
| MOD_LIST_FILE="$MODS/mod-list.json" | ||||
|  | ||||
| ALL_SPACE_AGE_MODS=("elevated-rails" "quality" "space-age") | ||||
|  | ||||
| if [[ ! -f "$MOD_LIST_FILE" ]]; then | ||||
|   # Create the mod-list.json file if it doesn't exist | ||||
|   echo '{"mods":[{"name":"base","enabled":true}]}' > "$MOD_LIST_FILE" | ||||
| fi | ||||
|  | ||||
| enable_mod() | ||||
| { | ||||
|   echo "Enable mod $1 for DLC" | ||||
|   jq --arg mod_name "$1" 'if .mods | map(.name) | index($mod_name) then .mods |= map(if .name == $mod_name and .enabled == false then .enabled = true else . end) else . end' "$MOD_LIST_FILE" > "$MOD_LIST_FILE.tmp" | ||||
|   mv "$MOD_LIST_FILE.tmp" "$MOD_LIST_FILE" | ||||
| } | ||||
|  | ||||
| disable_mod() | ||||
| { | ||||
|   echo "Disable mod $1 for DLC" | ||||
|   jq --arg mod_name "$1" 'if .mods | map(.name) | index($mod_name) then .mods |= map(if .name == $mod_name and .enabled == true then .enabled = false else . end) else .mods += [{"name": $mod_name, "enabled": false}] end' "$MOD_LIST_FILE" > "$MOD_LIST_FILE.tmp" | ||||
|   mv "$MOD_LIST_FILE.tmp" "$MOD_LIST_FILE" | ||||
| } | ||||
|  | ||||
| # Enable or disable DLCs if configured | ||||
| if [[ ${DLC_SPACE_AGE:-} == "true" ]]; then | ||||
|   # Define the DLC mods | ||||
|   ENABLE_MODS=(${ALL_SPACE_AGE_MODS[@]}) | ||||
| elif [[ ${DLC_SPACE_AGE:-} == "false" ]]; then | ||||
|   # Define the DLC mods | ||||
|   DISABLE_MODS=(${ALL_SPACE_AGE_MODS[@]}) | ||||
| else | ||||
|   ENABLE_MODS=() | ||||
|   DISABLE_MODS=() | ||||
|  | ||||
|   for SPACE_AGE_MOD in "${ALL_SPACE_AGE_MODS[@]}"; do | ||||
|     REGEX="(^|\s)$SPACE_AGE_MOD($|\s)" | ||||
|     if [[ "$DLC_SPACE_AGE" =~ $REGEX ]]; then | ||||
|       ENABLE_MODS+=($SPACE_AGE_MOD) | ||||
|     else | ||||
|       DISABLE_MODS+=($SPACE_AGE_MOD) | ||||
|     fi | ||||
|   done | ||||
| fi | ||||
|  | ||||
| # Iterate over each DLC mod to enable | ||||
| for MOD in "${ENABLE_MODS[@]}"; do | ||||
|   enable_mod "$MOD" | ||||
| done | ||||
|  | ||||
| # Iterate over each DLC mod to disable | ||||
| for MOD in "${DISABLE_MODS[@]}"; do | ||||
|   disable_mod "$MOD" | ||||
| done | ||||
| @@ -1,10 +1,12 @@ | ||||
| #!/bin/bash | ||||
| set -eoux pipefail | ||||
| 
 | ||||
| FACTORIO_VOL=/factorio | ||||
| LOAD_LATEST_SAVE="${LOAD_LATEST_SAVE:-true}" | ||||
| GENERATE_NEW_SAVE="${GENERATE_NEW_SAVE:-false}" | ||||
| PRESET="${PRESET:-""}" | ||||
| SAVE_NAME="${SAVE_NAME:-""}" | ||||
| BIND="${BIND:-""}" | ||||
| CONSOLE_LOG_LOCATION="${CONSOLE_LOG_LOCATION:-""}" | ||||
| 
 | ||||
| mkdir -p "$FACTORIO_VOL" | ||||
| mkdir -p "$SAVES" | ||||
| @@ -41,16 +43,22 @@ if [[ ${UPDATE_MODS_ON_START:-} == "true" ]]; then | ||||
|   ./docker-update-mods.sh | ||||
| fi | ||||
| 
 | ||||
| if [[ $(id -u) = 0 ]]; then | ||||
| ./docker-dlc.sh | ||||
| 
 | ||||
| EXEC="" | ||||
| if [[ $(id -u) == 0 ]]; then | ||||
|   # Update the User and Group ID based on the PUID/PGID variables | ||||
|   usermod -o -u "$PUID" factorio | ||||
|   groupmod -o -g "$PGID" factorio | ||||
|   # Take ownership of factorio data if running as root | ||||
|   chown -R factorio:factorio "$FACTORIO_VOL" | ||||
|   # Drop to the factorio user | ||||
|   SU_EXEC="su-exec factorio" | ||||
| else | ||||
|   SU_EXEC="" | ||||
|   EXEC="runuser -u factorio -g factorio --" | ||||
| fi | ||||
| if [[ -f /bin/box64 ]]; then | ||||
|   # Use an emulator to run on ARM hosts | ||||
|   # this only gets installed when the target docker platform is linux/arm64 | ||||
|   EXEC="$EXEC /bin/box64" | ||||
| fi | ||||
| 
 | ||||
| sed -i '/write-data=/c\write-data=\/factorio/' /opt/factorio/config/config.ini | ||||
| @@ -69,10 +77,18 @@ if [[ $GENERATE_NEW_SAVE == true ]]; then | ||||
|     if [[ -f "$SAVES/$SAVE_NAME.zip" ]]; then | ||||
|         echo "Map $SAVES/$SAVE_NAME.zip already exists, skipping map generation" | ||||
|     else | ||||
|         $SU_EXEC /opt/factorio/bin/x64/factorio \ | ||||
|             --create "$SAVES/$SAVE_NAME.zip" \ | ||||
|             --map-gen-settings "$CONFIG/map-gen-settings.json" \ | ||||
|             --map-settings "$CONFIG/map-settings.json" | ||||
|         if [[ ! -z "$PRESET" ]]; then | ||||
|             $EXEC /opt/factorio/bin/x64/factorio \ | ||||
|                 --create "$SAVES/$SAVE_NAME.zip" \ | ||||
|                 --preset "$PRESET" \ | ||||
|                 --map-gen-settings "$CONFIG/map-gen-settings.json" \ | ||||
|                 --map-settings "$CONFIG/map-settings.json" | ||||
|         else | ||||
|             $EXEC /opt/factorio/bin/x64/factorio \ | ||||
|                 --create "$SAVES/$SAVE_NAME.zip" \ | ||||
|                 --map-gen-settings "$CONFIG/map-gen-settings.json" \ | ||||
|                 --map-settings "$CONFIG/map-settings.json" | ||||
|         fi | ||||
|     fi | ||||
| fi | ||||
| 
 | ||||
| @@ -86,8 +102,17 @@ FLAGS=(\ | ||||
|   --server-adminlist "$CONFIG/server-adminlist.json" \ | ||||
|   --rcon-password "$(cat "$CONFIG/rconpw")" \ | ||||
|   --server-id /factorio/config/server-id.json \ | ||||
|   --mod-directory "$MODS" \ | ||||
| ) | ||||
| 
 | ||||
| if [ -n "$CONSOLE_LOG_LOCATION" ]; then | ||||
|   FLAGS+=( --console-log "$CONSOLE_LOG_LOCATION" ) | ||||
| fi | ||||
| 
 | ||||
| if [ -n "$BIND" ]; then | ||||
|   FLAGS+=( --bind "$BIND" ) | ||||
| fi | ||||
| 
 | ||||
| if [[ $LOAD_LATEST_SAVE == true ]]; then | ||||
|     FLAGS+=( --start-server-load-latest ) | ||||
| else | ||||
| @@ -95,4 +120,4 @@ else | ||||
| fi | ||||
| 
 | ||||
| # shellcheck disable=SC2086 | ||||
| exec $SU_EXEC /opt/factorio/bin/x64/factorio "${FLAGS[@]}" "$@" | ||||
| exec $EXEC /opt/factorio/bin/x64/factorio "${FLAGS[@]}" "$@" | ||||
| @@ -5,7 +5,7 @@ if [[ -f /run/secrets/username ]]; then | ||||
|   USERNAME=$(cat /run/secrets/username) | ||||
| fi | ||||
| 
 | ||||
| if [[ -f /run/secrets/username ]]; then | ||||
| if [[ -f /run/secrets/token ]]; then | ||||
|   TOKEN=$(cat /run/secrets/token) | ||||
| fi | ||||
| 
 | ||||
| @@ -6,6 +6,8 @@ if [[ -z ${1:-} ]]; then | ||||
| fi | ||||
| 
 | ||||
| SERVER_SCENARIO="$1" | ||||
| PRESET="${PRESET:-""}" | ||||
| 
 | ||||
| mkdir -p "$SAVES" | ||||
| mkdir -p "$CONFIG" | ||||
| mkdir -p "$MODS" | ||||
| @@ -32,6 +34,9 @@ fi | ||||
| exec /opt/factorio/bin/x64/factorio \ | ||||
|   --port "$PORT" \ | ||||
|   --start-server-load-scenario "$SERVER_SCENARIO" \ | ||||
|   --preset "$PRESET" \ | ||||
|   --map-gen-settings "$CONFIG/map-gen-settings.json" \ | ||||
|   --map-settings "$CONFIG/map-settings.json" \ | ||||
|   --server-settings "$CONFIG/server-settings.json" \ | ||||
|   --server-banlist "$CONFIG/server-banlist.json" \ | ||||
|   --server-whitelist "$CONFIG/server-whitelist.json" \ | ||||
| @@ -25,11 +25,12 @@ print_failure() | ||||
| 
 | ||||
| update_mod() | ||||
| { | ||||
|   MOD_NAME="${1// /%20}" | ||||
|   MOD_NAME="$1" | ||||
|   MOD_NAME_ENCODED="${1// /%20}" | ||||
| 
 | ||||
|   print_step "Checking for update of mod $MOD_NAME..." | ||||
|   print_step "Checking for update of mod $MOD_NAME for factorio $FACTORIO_VERSION ..." | ||||
| 
 | ||||
|   MOD_INFO_URL="$MOD_BASE_URL/api/mods/$MOD_NAME" | ||||
|   MOD_INFO_URL="$MOD_BASE_URL/api/mods/$MOD_NAME_ENCODED" | ||||
|   MOD_INFO_JSON=$(curl --silent "$MOD_INFO_URL") | ||||
| 
 | ||||
|   if ! echo "$MOD_INFO_JSON" | jq -e .name >/dev/null; then | ||||
| @@ -53,7 +54,7 @@ update_mod() | ||||
|     return 0 | ||||
|   fi | ||||
| 
 | ||||
|   print_step "Downloading..." | ||||
|   print_step "  Downloading $MOD_FILENAME" | ||||
|   FULL_URL="$MOD_BASE_URL$MOD_URL?username=$USERNAME&token=$TOKEN" | ||||
|   HTTP_STATUS=$(curl --silent -L -w "%{http_code}" -o "$MOD_DIR/$MOD_FILENAME" "$FULL_URL") | ||||
| 
 | ||||
| @@ -1,35 +0,0 @@ | ||||
| #!/bin/bash | ||||
|  | ||||
| # This script is licensed under MIT and was originally written by Peter Evans. You can find a copy of the MIT license next to this file. | ||||
| # The original file is available on his Github repo under the following link: | ||||
| # https://github.com/peter-evans/dockerhub-description/blob/84d38211e27bb9b9effefa718f8c734db8adc5e1/entrypoint.sh | ||||
|  | ||||
| set -euo pipefail | ||||
| IFS=$'\n\t' | ||||
|  | ||||
| # Set the default path to README.md | ||||
| README_FILEPATH=${README_FILEPATH:="./README.md"} | ||||
|  | ||||
| # Check the file size | ||||
| if [[ $(wc -c <${README_FILEPATH}) -gt 25000 ]]; then | ||||
|   echo "File size exceeds the maximum allowed 25000 bytes" | ||||
|   exit 1 | ||||
| fi | ||||
|  | ||||
| # Acquire a token for the Docker Hub API | ||||
| echo "Acquiring token" | ||||
| # shellcheck disable=2089 | ||||
| LOGIN_PAYLOAD="{\"username\": \"${DOCKERHUB_USERNAME}\", \"password\": \"${DOCKERHUB_PASSWORD}\"}" | ||||
| TOKEN=$(curl -s -H "Content-Type: application/json" -X POST -d "${LOGIN_PAYLOAD}" https://hub.docker.com/v2/users/login/ | jq -r .token) | ||||
|  | ||||
| # Send a PATCH request to update the description of the repository | ||||
| echo "Sending PATCH request" | ||||
| REPO_URL="https://hub.docker.com/v2/repositories/${DOCKERHUB_REPOSITORY}/" | ||||
| RESPONSE_CODE=$(curl -s --write-out "%{response_code}" --output /dev/null -H "Authorization: JWT ${TOKEN}" -X PATCH --data-urlencode full_description@${README_FILEPATH} "${REPO_URL}") | ||||
| echo "Received response code: $RESPONSE_CODE" | ||||
|  | ||||
| if [[ $RESPONSE_CODE -eq 200 ]]; then | ||||
|   exit 0 | ||||
| else | ||||
|   exit 1 | ||||
| fi | ||||
							
								
								
									
										116
									
								
								update.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										116
									
								
								update.sh
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,116 @@ | ||||
| #!/bin/bash | ||||
| set -e | ||||
| SEMVER_REGEX="^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$" | ||||
|  | ||||
| stable_online_version=$(curl 'https://factorio.com/api/latest-releases' | jq '.stable.headless' -r) | ||||
| experimental_online_version=$(curl 'https://factorio.com/api/latest-releases' | jq '.experimental.headless' -r) | ||||
|  | ||||
| stable_sha256=$(curl "https://factorio.com/download/sha256sums/" | grep -E "(factorio_headless_x64_|factorio-headless_linux_)${stable_online_version}.tar.xz" | awk '{print $1}') | ||||
| experimental_sha256=$(curl "https://factorio.com/download/sha256sums/" | grep -E "(factorio_headless_x64_|factorio-headless_linux_)${experimental_online_version}.tar.xz" | awk '{print $1}') | ||||
|  | ||||
| stable_current_version=$(jq 'with_entries(select(.value.tags | index("stable"))) | keys | .[0]' buildinfo.json -r) | ||||
| latest_current_version=$(jq 'with_entries(select(.value.tags | index("latest"))) | keys | .[0]' buildinfo.json -r) | ||||
|  | ||||
| echo "stable_online_version=${stable_online_version} experimental_online_version=${experimental_online_version}" | ||||
| echo "stable_current_version=${stable_current_version} latest_current_version=${latest_current_version}" | ||||
|  | ||||
| if [[ -z "${stable_online_version}" ]] || [[ -z "${experimental_online_version}" ]]; then | ||||
|     exit | ||||
| fi | ||||
| if [[ "${stable_current_version}" == "${stable_online_version}" ]] && [[ "${latest_current_version}" == "${experimental_online_version}" ]]; then | ||||
|     exit | ||||
| fi | ||||
|  | ||||
| function get-semver(){ | ||||
|     local ver=$1 | ||||
|     local type=$2 | ||||
|     if [[ "$ver" =~ $SEMVER_REGEX ]]; then | ||||
|         local major=${BASH_REMATCH[1]} | ||||
|         local minor=${BASH_REMATCH[2]} | ||||
|         local patch=${BASH_REMATCH[3]} | ||||
|     fi | ||||
|     case $type in | ||||
|         major) | ||||
|             echo "$major" | ||||
|             ;; | ||||
|         minor) | ||||
|             echo "$minor" | ||||
|             ;; | ||||
|         patch) | ||||
|             echo "$patch" | ||||
|             ;; | ||||
|     esac | ||||
| } | ||||
|  | ||||
| stableOnlineVersionMajor=$(get-semver "${stable_online_version}" major) | ||||
| stableOnlineVersionMinor=$(get-semver "${stable_online_version}" minor) | ||||
| experimentalOnlineVersionMajor=$(get-semver "${experimental_online_version}" major) | ||||
| experimentalOnlineVersionMinor=$(get-semver "${experimental_online_version}" minor) | ||||
| stableCurrentVersionMajor=$(get-semver "${stable_current_version}" major) | ||||
| stableCurrentVersionMinor=$(get-semver "${stable_current_version}" minor) | ||||
| latestCurrentVersionMajor=$(get-semver "${latest_current_version}" major) | ||||
| latestCurrentVersionMinor=$(get-semver "${latest_current_version}" minor) | ||||
|  | ||||
| stableOnlineVersionShort=$stableOnlineVersionMajor.$stableOnlineVersionMinor | ||||
| experimentalOnlineVersionShort=$experimentalOnlineVersionMajor.$experimentalOnlineVersionMinor | ||||
| stableCurrentVersionShort=$stableCurrentVersionMajor.$stableCurrentVersionMinor | ||||
| latestCurrentVersionShort=$latestCurrentVersionMajor.$latestCurrentVersionMinor | ||||
|  | ||||
| echo "stableOnlineVersionShort=${stableOnlineVersionShort} experimentalOnlineVersionShort=${experimentalOnlineVersionShort}" | ||||
| echo "stableCurrentVersionShort=${stableCurrentVersionShort} latestCurrentVersionShort=${latestCurrentVersionShort}" | ||||
|  | ||||
| tmpfile=$(mktemp) | ||||
|  | ||||
| # Remove stable tag | ||||
| cp buildinfo.json "$tmpfile" | ||||
| jq --arg stable_current_version "$stable_current_version" 'with_entries(if .key == $stable_current_version then .value.tags |= . - ["stable"] else . end)' "$tmpfile" > buildinfo.json | ||||
| rm -f -- "$tmpfile" | ||||
|  | ||||
| # Remove latest tag | ||||
| cp buildinfo.json "$tmpfile" | ||||
| jq --arg latest_current_version "$latest_current_version" 'with_entries(if .key == $latest_current_version then .value.tags |= . - ["latest"] else . end)' "$tmpfile" > buildinfo.json | ||||
| rm -f -- "$tmpfile" | ||||
|  | ||||
| # Update tag by stable | ||||
| cp buildinfo.json "$tmpfile" | ||||
| if [[ $stableOnlineVersionShort == "$stableCurrentVersionShort" ]]; then | ||||
|     jq --arg stable_current_version "$stable_current_version" --arg stable_online_version "$stable_online_version" --arg sha256 "$stable_sha256" 'with_entries(if .key == $stable_current_version then .key |= $stable_online_version | .value.sha256 |= $sha256 | .value.tags |= . - [$stable_current_version] + [$stable_online_version] else . end)' "$tmpfile" > buildinfo.json | ||||
| else | ||||
|     jq --arg stable_current_version "$stable_current_version" --arg stable_online_version "$stable_online_version" --arg sha256 "$stable_sha256" --arg stableOnlineVersionShort "$stableOnlineVersionShort" --arg stableOnlineVersionMajor "$stableOnlineVersionMajor" 'with_entries(if .key == $stable_current_version then .value.tags |= . - ["latest","stable",$stableOnlineVersionMajor] else . end) | to_entries | . + [{ key: $stable_online_version, value: { sha256: $sha256, tags: ["latest","stable",("stable-" + $stable_online_version),$stableOnlineVersionMajor,$stableOnlineVersionShort,$stable_online_version]}}] | from_entries' "$tmpfile" > buildinfo.json | ||||
| fi | ||||
| rm -f -- "$tmpfile" | ||||
|  | ||||
| # Update tag by latest | ||||
| cp buildinfo.json "$tmpfile" | ||||
| if [[ $experimental_online_version != "$stable_online_version" ]]; then | ||||
|     if [[ $stableOnlineVersionShort == "$experimentalOnlineVersionShort" ]]; then | ||||
|         jq --arg experimental_online_version "$experimental_online_version" --arg stable_online_version "$stable_online_version" --arg sha256 "$experimental_sha256" 'with_entries(if .key == $stable_online_version then .value.tags |= . - ["latest"] else . end) | to_entries | . + [{ key: $experimental_online_version, value: { sha256: $sha256, tags: ["latest", $experimental_online_version]}}] | from_entries' "$tmpfile" > buildinfo.json | ||||
|     else | ||||
|         jq --arg experimental_online_version "$experimental_online_version" --arg stable_online_version "$stable_online_version" --arg sha256 "$experimental_sha256" --arg experimentalOnlineVersionShort   "$experimentalOnlineVersionShort" --arg experimentalOnlineVersionMajor "$experimentalOnlineVersionMajor" 'with_entries(if .key == $stable_online_version then .value.tags |= . - ["latest"] else . end) | to_entries | . + [{ key: $experimental_online_version, value: { sha256: $sha256, tags: ["latest",$experimentalOnlineVersionMajor,$experimentalOnlineVersionShort,$experimental_online_version]}}] | from_entries' "$tmpfile" > buildinfo.json | ||||
|     fi | ||||
| fi | ||||
| rm -f -- "$tmpfile" | ||||
|  | ||||
| readme_tags=$(jq --sort-keys 'keys[]' buildinfo.json | tac | (while read -r line | ||||
| do | ||||
|   tags="$tags\n* "$(jq --sort-keys ".$line.tags | sort | .[]" buildinfo.json | sed 's/"/`/g' | sed ':a; /$/N; s/\n/, /; ta') | ||||
| done && printf "%s\n\n" "$tags")) | ||||
|  | ||||
| perl -i -0777 -pe "s/<!-- start autogeneration tags -->.+<!-- end autogeneration tags -->/<!-- start autogeneration tags -->$readme_tags<!-- end autogeneration tags -->/s" README.md | ||||
|  | ||||
| # Replace VERSION and SHA256 args in docker-compose.yaml with latest stable values. | ||||
| docker_compose_path="docker/docker-compose.yml" | ||||
| sov="VERSION=${stable_online_version}" yq -i '.services.factorio.build.args[0] = env(sov)' "$docker_compose_path" | ||||
| sha="SHA256=${stable_sha256}" yq -i '.services.factorio.build.args[1] = env(sha)' "$docker_compose_path" | ||||
|  | ||||
| git config user.name github-actions[bot] | ||||
| git config user.email 41898282+github-actions[bot]@users.noreply.github.com | ||||
|  | ||||
| git add buildinfo.json | ||||
| git add README.md | ||||
| git add docker/docker-compose.yml | ||||
| git commit -a -m "Auto Update Factorio to stable version: ${stable_online_version} experimental version: ${experimental_online_version}" | ||||
|  | ||||
| git tag -f latest | ||||
| git push | ||||
| git push origin --tags -f | ||||
		Reference in New Issue
	
	Block a user