Compare commits

...

7 Commits

Author SHA1 Message Date
d421adab67 update to 0.17.38 2019-05-10 14:39:11 +00:00
b0cedbbe1b Update docker-entrypoint.sh (#253) 2019-05-10 01:27:25 +02:00
010b96e0b0 update to 0.17.37 2019-05-07 16:29:12 +00:00
621ccf4282 Fixed naming of $SCENARIOS (#242)
Fixed naming of `$SCENARIOS`
2019-05-04 16:18:06 +02:00
1204b97fca update to 0.17.36 2019-05-03 16:29:13 +00:00
aef16e83a7 Fixed naming of $SCENARIOS
Renamed local variable `$SCENARIO` to `$SERVER_SCENARIO`
2019-05-02 12:07:38 -04:00
605ca74c0e Add travis ci, linter, merge shellcheck, fix some issues (#241)
* Quote all vars, remove useless echo/sub-shell, add shebands, fail on unset vars, enable pipefail, formatting

* Add CI including linting via hadolint nad shellcheck

* Update all base images to tag 3.9

* Switch to maintainer labels

* Quote vars

* Remove commented code

* Ignore if the folder exists
2019-05-02 17:28:20 +02:00
15 changed files with 92 additions and 27 deletions

14
.hadolint.yaml Normal file
View File

@ -0,0 +1,14 @@
ignored:
# ignore apt version pinning
- DL3008
# ignore pip version pinning
- DL3013
# ignore apk version pinning
- DL3018
# ignore pipefail cause Balena/resin.io images do not work with it
- DL4006
# ignore false positive regex
- SC1083
- SC2086
# ignore as need for debug
- SC2005

35
.travis.yml Normal file
View File

@ -0,0 +1,35 @@
dist: xenial
sudo: required
language: bash
services:
- docker
addons:
apt:
packages:
- jq
jobs:
include:
- stage: test
env: HADOLINT=${HOME}/hadolint
install: curl -sLo ${HADOLINT} $(curl -s https://api.github.com/repos/hadolint/hadolint/releases/latest?access_token=${GITHUB_TOKEN} | jq -r '.assets | .[] | select(.name=="hadolint-Linux-x86_64") | .browser_download_url')
&& chmod 700 ${HADOLINT}
script:
- git ls-files --exclude='*Dockerfile' --ignored | xargs --max-lines=1 ${HADOLINT}
- bash -c 'shopt -s globstar; shellcheck **/*.sh'
- &build
stage: build
env: VERSION=0.17
script:
- ./build.sh $VERSION
after_success:
- if [ "$TRAVIS_BRANCH" == "master" ]; then
echo "$DOCKER_PASSWORD" | DOCKER login -u "$DOCKER_USERNAME" --password-stdin
docker push "factoriotools/docker_factorio_server:$VERSION"
fi
- <<: *build
env: VERSION=0.16
- <<: *build
env: VERSION=0.15
- <<: *build
env: VERSION=0.14

View File

@ -1,11 +1,11 @@
FROM frolvlad/alpine-glibc:alpine-3.4
FROM frolvlad/alpine-glibc:alpine-3.9
MAINTAINER https://github.com/dtandersen/docker_factorio_server
LABEL maintainer="https://github.com/dtandersen/docker_factorio_server"
ENV VERSION=0.14.23 \
SHA1=6ef84341c6fc1cf45cfdd6acc8468aaa117b9e8a
RUN mkdir /opt && \
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 && \

View File

@ -30,6 +30,6 @@ fi
exec /opt/factorio/bin/x64/factorio \
--port 34197 \
--start-server-load-latest \
--server-settings $CONFIG/server-settings.json \
--server-settings "$CONFIG/server-settings.json" \
--rcon-port 27015 \
--rcon-password "$(cat "$CONFIG/rconpw")"

View File

@ -1,13 +1,13 @@
FROM frolvlad/alpine-glibc:alpine-3.6
FROM frolvlad/alpine-glibc:alpine-3.9
MAINTAINER https://github.com/dtandersen/docker_factorio_server
LABEL maintainer="https://github.com/dtandersen/docker_factorio_server"
ENV PORT=34197 \
RCON_PORT=27015 \
VERSION=0.15.40 \
SHA1=f79a975f6b8c0ee87e2fa60f7d1f7133f332c3ec
RUN mkdir /opt && \
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 \

View File

@ -1,6 +1,6 @@
FROM frolvlad/alpine-glibc:alpine-3.7
FROM frolvlad/alpine-glibc:alpine-3.9
MAINTAINER https://github.com/dtandersen/docker_factorio_server
LABEL maintainer="https://github.com/dtandersen/docker_factorio_server"
ARG USER=factorio
ARG GROUP=factorio

View File

@ -2,7 +2,7 @@
if [ -z "$1" ]; then
echo "No argument supplied"
fi
SCENARIO=$1
SERVER_SCENARIO=$1
set -euo pipefail
@ -11,7 +11,7 @@ id
mkdir -p "$SAVES"
mkdir -p "$CONFIG"
mkdir -p "$MODS"
mkdir -p "$SCENARIO"
mkdir -p "$SCENARIOS"
#chown -R factorio /factorio
@ -33,7 +33,7 @@ fi
exec /opt/factorio/bin/x64/factorio \
--port "$PORT" \
--start-server-load-scenario "$SCENARIO" \
--start-server-load-scenario "$SERVER_SCENARIO" \
--server-settings "$CONFIG/server-settings.json" \
--server-whitelist "$CONFIG/server-whitelist.json" \
--server-banlist "$CONFIG/server-banlist.json" \

View File

@ -2,7 +2,7 @@
if [ -z "$1" ]; then
echo "No argument supplied"
fi
SCENARIO=$1
SERVER_SCENARIO=$1
set -euo pipefail
@ -11,7 +11,7 @@ id
mkdir -p "$SAVES"
mkdir -p "$CONFIG"
mkdir -p "$MODS"
mkdir -p "$SCENARIO"
mkdir -p "$SCENARIOS"
if [ ! -f "$CONFIG/server-settings.json" ]; then
cp /opt/factorio/data/server-settings.example.json "$CONFIG/server-settings.json"
@ -26,4 +26,4 @@ if [ ! -f "$CONFIG/map-settings.json" ]; then
fi
exec /opt/factorio/bin/x64/factorio \
--scenario2map "$SCENARIO"
--scenario2map "$SERVER_SCENARIO"

View File

@ -1,6 +1,6 @@
FROM frolvlad/alpine-glibc:alpine-3.9
MAINTAINER https://github.com/dtandersen/docker_factorio_server
LABEL maintainer="https://github.com/dtandersen/docker_factorio_server"
ARG USER=factorio
ARG GROUP=factorio
@ -9,8 +9,8 @@ ARG PGID=845
ENV PORT=34197 \
RCON_PORT=27015 \
VERSION=0.17.35 \
SHA1=d651bec5e5fc25eee8770732d4cbef1461764b8d \
VERSION=0.17.38 \
SHA1=c77f9858984213718318b3a4edc028be80274cf8 \
SAVES=/factorio/saves \
CONFIG=/factorio/config \
MODS=/factorio/mods \

View File

@ -29,7 +29,8 @@ 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
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
@ -46,7 +47,8 @@ else
SU_EXEC=""
fi
if ! find -L "$SAVES" -iname \*.zip -mindepth 1 -print | grep -q .; then
NRSAVES=$( find -L "$SAVES" -iname \*.zip -mindepth 1 | wc -l )
if [ $NRSAVES -eq 0 ]; then
# Generate a new map if no save ZIPs exist
$SU_EXEC /opt/factorio/bin/x64/factorio \
--create "$SAVES/_autosave1.zip" \

View File

@ -2,7 +2,7 @@
if [ -z "$1" ]; then
echo "No argument supplied"
fi
SCENARIO="$1"
SERVER_SCENARIO="$1"
set -euo pipefail
@ -11,7 +11,7 @@ id
mkdir -p "$SAVES"
mkdir -p "$CONFIG"
mkdir -p "$MODS"
mkdir -p "$SCENARIO"
mkdir -p "$SCENARIOS"
#chown -R factorio /factorio
@ -33,7 +33,7 @@ fi
exec /opt/factorio/bin/x64/factorio \
--port "$PORT" \
--start-server-load-scenario "$SCENARIO" \
--start-server-load-scenario "$SERVER_SCENARIO" \
--server-settings "$CONFIG/server-settings.json" \
--server-whitelist "$CONFIG/server-whitelist.json" \
--server-banlist "$CONFIG/server-banlist.json" \

View File

@ -2,7 +2,7 @@
if [ -z "$1" ]; then
echo "No argument supplied"
fi
SCENARIO="$1"
SERVER_SCENARIO="$1"
set -euo pipefail
@ -11,7 +11,7 @@ id
mkdir -p "$SAVES"
mkdir -p "$CONFIG"
mkdir -p "$MODS"
mkdir -p "$SCENARIO"
mkdir -p "$SCENARIOS"
if [ ! -f "$CONFIG/server-settings.json" ]; then
cp /opt/factorio/data/server-settings.example.json "$CONFIG/server-settings.json"
@ -26,4 +26,4 @@ if [ ! -f "$CONFIG/map-settings.json" ]; then
fi
exec /opt/factorio/bin/x64/factorio \
--scenario2map "$SCENARIO"
--scenario2map "$SERVER_SCENARIO"

View File

@ -1,6 +1,6 @@
# Factorio [![](https://images.microbadger.com/badges/image/factoriotools/factorio.svg)](https://microbadger.com/images/factoriotools/factorio "Get your own image badge on microbadger.com") [![Docker Pulls](https://img.shields.io/docker/pulls/factoriotools/factorio.svg)](https://hub.docker.com/r/factoriotools/factorio/) [![Docker Stars](https://img.shields.io/docker/stars/factoriotools/factorio.svg)](https://hub.docker.com/r/factoriotools/factorio/)
* `0.17.35`, `0.17`, `latest` [(0.17/Dockerfile)](https://github.com/dtandersen/docker_factorio_server/blob/master/0.17/Dockerfile)
* `0.17.38`, `0.17`, `latest` [(0.17/Dockerfile)](https://github.com/dtandersen/docker_factorio_server/blob/master/0.17/Dockerfile)
* `0.16.51`, `0.16`, `stable` [(0.16/Dockerfile)](https://github.com/dtandersen/docker_factorio_server/blob/master/0.16/Dockerfile)
* `0.15.40`, `0.15` [(0.15/Dockerfile)](https://github.com/dtandersen/docker_factorio_server/blob/master/0.15/Dockerfile)
* `0.14.23`, `0.14` [(0.14/Dockerfile)](https://github.com/dtandersen/docker_factorio_server/blob/master/0.14/Dockerfile)

12
build.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash
set -eo pipefail
if [ -z "$1" ] ; then
echo "Usage: ./build.sh \$VERSION"
else
VERSION="$1"
fi
cd "$VERSION" || exit
docker build . -t "factoriotools/docker_factorio_server:$VERSION"

2
lint.sh Executable file
View File

@ -0,0 +1,2 @@
#!/bin/bash
git ls-files --exclude='*Dockerfile' --ignored | xargs --max-lines=1 ./hadolint