├── .travis.yml ├── Dockerfile ├── LICENSE ├── README.md ├── factorio.crt └── new_smart_launch.sh /.travis.yml: -------------------------------------------------------------------------------- 1 | services: docker 2 | before_install: 3 | - docker -v 4 | # set env vars in the build settings to interact with repositories 5 | # see https://docs.travis-ci.com/user/environment-variables/#Defining-Variables-in-Repository-Settings 6 | - docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD" 7 | script: 8 | - | 9 | if [ -z "$TRAVIS_TAG" ]; then 10 | TRAVIS_TAG="latest" 11 | fi 12 | docker build -t "zopanix/factorio:${TRAVIS_TAG}" . 13 | deploy: 14 | provider: script 15 | script: docker tag "zopanix/factorio:${TRAVIS_TAG}" "zopanix/factorio:latest" && docker push "zopanix/factorio:${TRAVIS_TAG}" && docker push "zopanix/factorio:latest" 16 | skip_cleanup: false 17 | on: 18 | tags: true 19 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM frolvlad/alpine-glibc:alpine-3.3_glibc-2.23 2 | 3 | MAINTAINER zopanix 4 | 5 | WORKDIR /opt 6 | 7 | COPY ./new_smart_launch.sh /opt/ 8 | COPY ./factorio.crt /opt/ 9 | 10 | VOLUME /opt/factorio/saves /opt/factorio/mods 11 | 12 | EXPOSE 34197/udp 13 | EXPOSE 27015/tcp 14 | 15 | CMD ["./new_smart_launch.sh"] 16 | 17 | ENV FACTORIO_AUTOSAVE_INTERVAL=2 \ 18 | FACTORIO_AUTOSAVE_SLOTS=3 \ 19 | FACTORIO_ALLOW_COMMANDS=false \ 20 | FACTORIO_NO_AUTO_PAUSE=false \ 21 | VERSION=0.14.8 \ 22 | FACTORIO_SHA1=db71bd07aeb8b3775c9254597eaf5af858c84b7d \ 23 | FACTORIO_WAITING=false \ 24 | FACTORIO_MODE=normal \ 25 | FACTORIO_SERVER_NAME= \ 26 | FACTORIO_SERVER_DESCRIPTION= \ 27 | FACTORIO_SERVER_MAX_PLAYERS= \ 28 | FACTORIO_SERVER_VISIBILITY= \ 29 | FACTORIO_USER_USERNAME= \ 30 | FACTORIO_USER_PASSWORD= \ 31 | # FACTORIO_USER_TOKEN= \ 32 | FACTORIO_SERVER_GAME_PASSWORD= \ 33 | FACTORIO_SERVER_VERIFY_IDENTITY= 34 | 35 | RUN apk --update add bash curl && \ 36 | curl -sSL --cacert /opt/factorio.crt https://www.factorio.com/get-download/$VERSION/headless/linux64 -o /tmp/factorio_headless_x64_$VERSION.tar.gz && \ 37 | echo "$FACTORIO_SHA1 /tmp/factorio_headless_x64_$VERSION.tar.gz" | sha1sum -c && \ 38 | tar xzf /tmp/factorio_headless_x64_$VERSION.tar.gz && \ 39 | rm /tmp/factorio_headless_x64_$VERSION.tar.gz && \ 40 | apk del curl 41 | 42 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # THIS IS DEPRECATED please use https://hub.docker.com/r/factoriotools/factorio/ 2 | 3 | Factorio [![Build Status](https://travis-ci.org/zopanix/docker_factorio_server.svg?branch=master)](https://travis-ci.org/zopanix/docker_factorio_server) [![Docker Pulls](https://img.shields.io/docker/pulls/zopanix/factorio.svg?maxAge=2592000)](https://hub.docker.com/r/zopanix/factorio/) 4 | ===== 5 | Factorio Server in docker 6 | 7 | Versions 8 | ----- 9 | Please checkout the different [tags](https://hub.docker.com/r/zopanix/factorio/tags/) 10 | 11 | ### What's new ? 12 | #### Factorio 13 | See [factorio's site](http://www.factorio.com) 14 | #### Docker image 15 | * New semver for version !!!Tags have changed now!!! 16 | * Automated build with travis 17 | 18 | 19 | How to use ? 20 | ----- 21 | 22 | ### I just want to play ! 23 | This runs factorio with default settings, and your save will be kept : 24 | ``` 25 | docker run -d \ 26 | -v [PATH]:/opt/factorio/saves \ 27 | -p [PORT]:34197/udp \ 28 | zopanix/factorio 29 | ``` 30 | * Where [PATH] is a folder where you'll put your saves, if there already is a save in it with the string "save", that one will be taken by default, otherwize, a new one will be made. 31 | * Where [PORT] is the port number you choose, if you're going to launch it on your local machine, don't use the port 34197, take another one at random. 32 | 33 | ### Advanced usage 34 | #### Without map persistence 35 | ``` 36 | docker run -d \ 37 | -p [PORT]:34197/udp \ 38 | zopanix/factorio 39 | ``` 40 | This will generate a new random map with default settings. 41 | 42 | #### With map persistence 43 | ``` 44 | docker run -d \ 45 | -v [PATH]:/opt/factorio/saves \ 46 | -p [PORT]:34197/udp \ 47 | zopanix/factorio 48 | ``` 49 | This will generate a new random map with default settings and save it onto the volume. 50 | Replace [PATH] with a path to a folder on the host where the map will be saved. If existing saves exist it will take the latest one. 51 | 52 | #### Autosave interval 53 | You can set the autosave interval. By default it is set at 2 minutes bud you can change it by launching the container with the "FACTORIO_AUTOSAVE_INTERVAL" variable to whatever suits you best. 54 | ``` 55 | docker run -d \ 56 | --env FACTORIO_AUTOSAVE_INTERVAL=[NUMBER] \ 57 | -p [PORT]:34197/udp \ 58 | zopanix/factorio 59 | ``` 60 | Where [NUMBER] is the number of minutes between autosaves. 61 | 62 | #### Autosave slots 63 | You can set the number of autosave slots. By default it is set at 3 slots bud you can change it by launching the container with the "FACTORIO_AUTOSAVE_SLOTS" variable to whatever suits you best. 64 | ``` 65 | docker run -d \ 66 | --env FACTORIO_AUTOSAVE_SLOTS=[NUMBER] \ 67 | -p [PORT]:34197/udp \ 68 | zopanix/factorio 69 | ``` 70 | Where [NUMBER] is the number of autosave slots. 71 | 72 | #### Mounting mod volume 73 | As everybody knows about factorio is you can add mods to it. Now you can also do it in this docker image by mounting a volume. 74 | ``` 75 | docker run -d \ 76 | -v [PATH]:/opt/factorio/mods \ 77 | -p [PORT]:34197/udp \ 78 | zopanix/factorio 79 | ``` 80 | Where [PATH] is the path to the folder with your mods. 81 | 82 | #### Allowing in-game commands 83 | I've always disabled in-game commands because I think it is like cheating, however, you can enable them by setting the the "FACTORIO_ALLOW_COMMANDS" variable to "true". 84 | ``` 85 | docker run -d \ 86 | --env FACTORIO_ALLOW_COMMANDS=true \ 87 | -p [PORT]:34197/udp \ 88 | zopanix/factorio 89 | ``` 90 | 91 | #### Activating no-auto-pause in the game when no one is on the server 92 | I do not recommend this feature, bud it can make the game more difficult if you're up for a challenge :-). Just set the "FACTORIO_NO_AUTO_PAUSE" variable to "true". 93 | ``` 94 | docker run -d \ 95 | --env FACTORIO_NO_AUTO_PAUSE=true \ 96 | -p [PORT]:34197/udp \ 97 | zopanix/factorio 98 | ``` 99 | 100 | #### Change latency option 101 | I do not know what the real impact is, ut has always worked very well on default, but you can change the latency option in ms. 102 | ``` 103 | docker run -d \ 104 | --env FACTORIO_LATENCY_MS=[number] \ 105 | -p [PORT]:34197/udp \ 106 | zopanix/factorio 107 | ``` 108 | 109 | #### Factorio Mode 110 | I don't know what it is, possibilities are : heavy, complete or none (don't do anything...) 111 | ``` 112 | docker run -d \ 113 | --env FACTORIO_MODE=[MODE] \ 114 | -p [PORT]:34197/udp \ 115 | zopanix/factorio 116 | ``` 117 | 118 | #### Factorio Server Name 119 | Set Factorio Server Name (defaults to "Factorio Server") 120 | ``` 121 | docker run -d \ 122 | --env FACTORIO_SERVER_NAME=[NAME] 123 | -p [PORT]:34197/udp \ 124 | zopanix/factorio 125 | ``` 126 | 127 | #### Factorio Server Description 128 | Set Factorio Server Description (if not specified, no description will be set) 129 | ``` 130 | docker run -d \ 131 | --env FACTORIO_SERVER_DESCRIPTION=[DESCRIPTION] 132 | -p [PORT]:34197/udp \ 133 | zopanix/factorio 134 | ``` 135 | 136 | #### Factorio Server Max Players 137 | Set Factorio Server Max Players count (if not specified, maximum players is set to 255) 138 | ``` 139 | docker run -d \ 140 | --env FACTORIO_SERVER_MAX_PLAYERS=[NUMBER] 141 | -p [PORT]:34197/udp \ 142 | zopanix/factorio 143 | ``` 144 | 145 | #### Factorio Server Visibility 146 | [//]: # (Set Factorio Server Visibility (if set to public, factorio.com User Login and Password or Token are required)) 147 | Set Factorio Server Visibility (if set to public, factorio.com User Login and Password are required) 148 | ``` 149 | docker run -d \ 150 | --env FACTORIO_SERVER_VISIBILITY=[hidden,lan,public] 151 | -p [PORT]:34197/udp \ 152 | zopanix/factorio 153 | ``` 154 | 155 | #### Factorio Server factorio.com Login 156 | [//]: # (Set factorio.com User Login and Password or Token required for public server visibility) 157 | [//]: # ( --env FACTORIO_USER_TOKEN=[TOKEN]) 158 | Set factorio.com User Login and Password required for public server visibility 159 | ``` 160 | docker run -d \ 161 | --env FACTORIO_USER_USERNAME=[USERNAME] 162 | --env FACTORIO_USER_PASSWORD=[PASSWORD] 163 | -p [PORT]:34197/udp \ 164 | zopanix/factorio 165 | ``` 166 | 167 | #### Factorio Server Game Password 168 | Set Factorio Server Game Password (if not specified, no password will be set) 169 | ``` 170 | docker run -d \ 171 | --env FACTORIO_SERVER_GAME_PASSWORD=[GAME-PASSWORD] 172 | -p [PORT]:34197/udp \ 173 | zopanix/factorio 174 | ``` 175 | 176 | #### Factorio Server Verify User Identity 177 | Set Verify User Identity to true to require factorio.com account for user to login (defaults to false) 178 | ``` 179 | docker run -d \ 180 | --env FACTORIO_SERVER_VERIFY_IDENTITY=[false,true] 181 | -p [PORT]:34197/udp \ 182 | zopanix/factorio 183 | ``` 184 | 185 | #### Factorio RCON Console Port 186 | This allows you to expose a RCON Console 187 | ``` 188 | docker run -d \ 189 | -p [PORT]:34197/udp \ 190 | -p [PORT_RCON]:27015/tcp \ 191 | zopanix/factorio 192 | ``` 193 | Where PORT_RCON is the port you want to use. 194 | By default a random password is set bud ... see below 195 | 196 | #### Factorio RCON Console Password 197 | This allows you to set a password for RCON (if not specified, it will be random) 198 | ``` 199 | docker run -d \ 200 | --env FACTORIO_RCON_PASSWORD=[PASSWORD] \ 201 | -p [PORT]:34197/udp \ 202 | zopanix/factorio 203 | ``` 204 | 205 | #### Authorization Error 206 | If your container exits with the following error: 207 | ``` 208 | Info HttpSharedState.cpp:83: Status code: 401 209 | Info AuthServerConnector.cpp:40: Error in communication with auth server: code(401) message({ 210 | "message": "Username and password don't match", 211 | "status": 401 212 | }) 213 | Info AuthServerConnector.cpp:68: Auth server authorization error (Username and password don't match) 214 | Error Util.cpp:57: Unknown error 215 | ``` 216 | Check supplied Username and Password for mistakes. 217 | 218 | #### Waiting for ready 219 | This is a beta feature which has nothing to do with factorio... leave it as it is for the moment. I'm working with some collegues on something new which should work very well and please a lot of people. 220 | 221 | More to come 222 | -------------------------------------------------------------------------------- /factorio.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIGCDCCA/CgAwIBAgIQKy5u6tl1NmwUim7bo3yMBzANBgkqhkiG9w0BAQwFADCB 3 | hTELMAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4G 4 | A1UEBxMHU2FsZm9yZDEaMBgGA1UEChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNV 5 | BAMTIkNPTU9ETyBSU0EgQ2V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xNKWt9x+Tu5w/Rw5 88 | 6wwCURQtjr0W4MHfRnXnJK3s9EK0hZNwEGe6nQY1ShjTK3rMUUKhemPR5ruhxSvC 89 | Nr4TDea9Y355e6cJDUCrat2PisP29owaQgVR1EX1n6diIWgVIEM8med8vSTYqZEX 90 | c4g/VhsxOBi0cQ+azcgOno4uG+GMmIPLHzHxREzGBHNJdmAPx/i9F4BrLunMTA5a 91 | mnkPIAou1Z5jJh5VkpTYghdae9C8x49OhgQ= 92 | -----END CERTIFICATE----- 93 | -------------------------------------------------------------------------------- /new_smart_launch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo ' ___ ___ ___ ___ ___ ___ ' 3 | echo ' / /\ / /\ / /\ ___ / /\ / /\ ___ / /\ ' 4 | echo ' / /:/_ / /::\ / /:/ / /\ / /::\ / /::\ / /\ / /::\ ' 5 | echo ' / /:/ /\ / /:/\:\ / /:/ / /:/ / /:/\:\ / /:/\:\ / /:/ / /:/\:\ ' 6 | echo ' / /:/ /:/ / /:/~/::\ / /:/ ___ / /:/ / /:/ \:\ / /:/~/:/ /__/::\ / /:/ \:\ ' 7 | echo ' /__/:/ /:/ /__/:/ /:/\:\ /__/:/ / /\ / /::\ /__/:/ \__\:\ /__/:/ /:/___ \__\/\:\__ /__/:/ \__\:\' 8 | echo ' \ \:\/:/ \ \:\/:/__\/ \ \:\ / /:/ /__/:/\:\ \ \:\ / /:/ \ \:\/:::::/ \ \:\/\ \ \:\ / /:/' 9 | echo ' \ \::/ \ \::/ \ \:\ /:/ \__\/ \:\ \ \:\ /:/ \ \::/~~~~ \__\::/ \ \:\ /:/ ' 10 | echo ' \ \:\ \ \:\ \ \:\/:/ \ \:\ \ \:\/:/ \ \:\ /__/:/ \ \:\/:/ ' 11 | echo ' \ \:\ \ \:\ \ \::/ \__\/ \ \::/ \ \:\ \__\/ \ \::/ ' 12 | echo ' \__\/ \__\/ \__\/ \__\/ \__\/ \__\/ ' 13 | # Checking if server is ready 14 | if [ $FACTORIO_WAITING == true ] 15 | then 16 | until [ -f /opt/factorio/saves/ready ] 17 | do 18 | echo "# Waiting for backup daemon to be ready" 19 | sleep 1 20 | done 21 | fi 22 | # Setting initial command 23 | factorio_command="/opt/factorio/bin/x64/factorio" 24 | # Include server-settings.json if one or more variables are populated 25 | # removed FACTORIO_USER_TOKEN condition cause of bug (https://github.com/zopanix/docker_factorio_server/issues/23) 26 | if [ "$FACTORIO_SERVER_NAME" ] \ 27 | || [ "$FACTORIO_SERVER_DESCRIPTION" ] \ 28 | || [ "$FACTORIO_SERVER_MAX_PLAYERS" ] \ 29 | || [ "$FACTORIO_SERVER_VISIBILITY" ] \ 30 | || [ "$FACTORIO_USER_USERNAME" ] \ 31 | || [ "$FACTORIO_USER_PASSWORD" ] \ 32 | || [ "$FACTORIO_SERVER_GAME_PASSWORD" ] \ 33 | || [ "$FACTORIO_SERVER_VERIFY_IDENTITY" ] 34 | then 35 | factorio_command="$factorio_command --server-settings /opt/factorio/server-settings.json" 36 | # Set Server Name default value if not set by user param 37 | if [ -z $FACTORIO_SERVER_NAME ] 38 | then 39 | FACTORIO_SERVER_NAME="Factorio Server $VERSION" 40 | fi 41 | # Set Visibility default value if not set by user param 42 | if [ -z $FACTORIO_SERVER_VISIBILITY ] 43 | then 44 | FACTORIO_SERVER_VISIBILITY="hidden" 45 | fi 46 | # Set Verify User Identity default value if not set by user param 47 | if [ -z $FACTORIO_SERVER_VERIFY_IDENTITY ] 48 | then 49 | FACTORIO_SERVER_VERIFY_IDENTITY="false" 50 | fi 51 | # Check for supplied credentials if visibility is set to public 52 | if [ "$FACTORIO_SERVER_VISIBILITY" == "public" ] 53 | then 54 | if [ -z $FACTORIO_USER_USERNAME ] 55 | then 56 | echo "###" 57 | echo "# Server Visibility is set to public but no factorio.com Username is supplied!" 58 | echo "# Append: --env FACTORIO_USER_USERNAME=[USERNAME]" 59 | echo "# Defaulting back to Server Visibility: hidden" 60 | echo "###" 61 | FACTORIO_SERVER_VISIBILITY="hidden" 62 | fi 63 | if [ "$FACTORIO_USER_USERNAME" ] 64 | then 65 | # if [ -z $FACTORIO_USER_PASSWORD ] && [ -z $FACTORIO_USER_TOKEN ] 66 | if [ -z $FACTORIO_USER_PASSWORD ] 67 | then 68 | echo "###" 69 | # echo "# Server Visibility is set to public but neither factorio.com Password or Token is supplied!" 70 | echo "# Server Visibility is set to public but neither factorio.com Password is supplied!" 71 | echo "# Append: --env FACTORIO_USER_PASSWORD=[PASSWORD]" 72 | # echo "# or --env FACTORIO_USER_TOKEN=[TOKEN]" 73 | echo "# Defaulting back to Server Visibility: hidden" 74 | echo "###" 75 | FACTORIO_SERVER_VISIBILITY="hidden" 76 | fi 77 | fi 78 | fi 79 | fi 80 | # Populate server-settings.json 81 | SERVER_SETTINGS=/opt/factorio/server-settings.json 82 | cat << EOF > $SERVER_SETTINGS 83 | { 84 | "name": "$FACTORIO_SERVER_NAME", 85 | "description": "$FACTORIO_SERVER_DESCRIPTION", 86 | "max_players": "$FACTORIO_SERVER_MAX_PLAYERS", 87 | 88 | "_comment_visibility": ["public: Game will be published on the official Factorio matching server", 89 | "lan: Game will be broadcast on LAN", 90 | "hidden: Game will not be published anywhere"], 91 | "visibility": "$FACTORIO_SERVER_VISIBILITY", 92 | 93 | "_comment_credentials": "Your factorio.com login credentials. Required for games with visibility public", 94 | "username": "$FACTORIO_USER_USERNAME", 95 | "password": "$FACTORIO_USER_PASSWORD", 96 | 97 | "_comment_token": "Authentication token. May be used instead of 'password' above.", 98 | "token": "$FACTORIO_USER_TOKEN", 99 | 100 | "game_password": "$FACTORIO_SERVER_GAME_PASSWORD", 101 | 102 | "_comment_verify_user_identity": "When set to true, the server will only allow clients that have a valid Factorio.com account", 103 | "verify_user_identity": $FACTORIO_SERVER_VERIFY_IDENTITY 104 | } 105 | EOF 106 | # Setting heavy mode option 107 | if [ "$FACTORIO_MODE" == "heavy" ] 108 | then 109 | factorio_command="$factorio_command --heavy" 110 | fi 111 | # Setting complete mode option 112 | if [ "$FACTORIO_MODE" == "complete" ] 113 | then 114 | factorio_command="$factorio_command --complete" 115 | fi 116 | # Setting allow-commands option 117 | factorio_command="$factorio_command --allow-commands $FACTORIO_ALLOW_COMMANDS" 118 | # Setting auto-pause option 119 | if [ "$FACTORIO_NO_AUTO_PAUSE" == true ] 120 | then 121 | factorio_command="$factorio_command --no-auto-pause" 122 | fi 123 | # Setting autosave-interval option 124 | factorio_command="$factorio_command --autosave-interval $FACTORIO_AUTOSAVE_INTERVAL" 125 | # Setting autosave-slots option 126 | factorio_command="$factorio_command --autosave-slots $FACTORIO_AUTOSAVE_SLOTS" 127 | # Setting rcon-port option 128 | factorio_command="$factorio_command --rcon-port 27015" 129 | # Setting rcon password option 130 | if [ -z $FACTORIO_RCON_PASSWORD ] 131 | then 132 | FACTORIO_RCON_PASSWORD=$(cat /dev/urandom | tr -dc 'a-f0-9' | head -c16) 133 | echo "###" 134 | echo "# RCON password is '$FACTORIO_RCON_PASSWORD'" 135 | echo "###" 136 | fi 137 | factorio_command="$factorio_command --rcon-password $FACTORIO_RCON_PASSWORD" 138 | # Show server-settings.json config 139 | # removed FACTORIO_USER_TOKEN condition cause of bug (https://github.com/zopanix/docker_factorio_server/issues/23) 140 | if [ "$FACTORIO_SERVER_NAME" ] \ 141 | || [ "$FACTORIO_SERVER_DESCRIPTION" ] \ 142 | || [ "$FACTORIO_SERVER_MAX_PLAYERS" ] \ 143 | || [ "$FACTORIO_SERVER_VISIBILITY" ] \ 144 | || [ "$FACTORIO_USER_USERNAME" ] \ 145 | || [ "$FACTORIO_USER_PASSWORD" ] \ 146 | || [ "$FACTORIO_SERVER_GAME_PASSWORD" ] \ 147 | || [ "$FACTORIO_SERVER_VERIFY_IDENTITY" ] 148 | then 149 | echo "###" 150 | echo "# Server Config:" 151 | echo "# Server Name = '$FACTORIO_SERVER_NAME'" 152 | echo "# Server Description = '$FACTORIO_SERVER_DESCRIPTION'" 153 | echo "# Server Password = '$FACTORIO_SERVER_GAME_PASSWORD'" 154 | echo "# Max Players = '$FACTORIO_SERVER_MAX_PLAYERS'" 155 | echo "# Server Visibility = '$FACTORIO_SERVER_VISIBILITY'" 156 | echo "# Verify User Identify = '$FACTORIO_SERVER_VERIFY_IDENTITY'" 157 | echo "# Factorio Username = '$FACTORIO_USER_USERNAME'" 158 | echo "# Factorio Password = '$FACTORIO_USER_PASSWORD'" 159 | # echo "# Factorio User Token = '$FACTORIO_USER_TOKEN'" 160 | echo "###" 161 | fi 162 | # TODO Adding this because of bug, will need to be removed once bug in factorio is fixed 163 | cd /opt/factorio/saves 164 | # Handling save settings 165 | save_dir="/opt/factorio/saves" 166 | if [ -z $FACTORIO_SAVE ] 167 | then 168 | if [ "$(ls -A $save_dir)" ] 169 | then 170 | echo "###" 171 | echo "# Taking latest save" 172 | echo "###" 173 | else 174 | echo "###" 175 | echo "# Creating a new map [save.zip]" 176 | echo "###" 177 | /opt/factorio/bin/x64/factorio --create save.zip 178 | fi 179 | factorio_command="$factorio_command --start-server-load-latest" 180 | else 181 | factorio_command="$factorio_command --start-server $FACTORIO_SAVE" 182 | fi 183 | echo "###" 184 | echo "# Launching Game" 185 | echo "###" 186 | # Closing stdin 187 | exec 0<&- 188 | exec $factorio_command 189 | --------------------------------------------------------------------------------