Skip to content

Commit

Permalink
Add travis ci, linter, merge shellcheck, fix some issues (factoriotoo…
Browse files Browse the repository at this point in the history
…ls#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
  • Loading branch information
Fank authored May 2, 2019
1 parent e34180c commit 605ca74
Show file tree
Hide file tree
Showing 9 changed files with 73 additions and 10 deletions.
14 changes: 14 additions & 0 deletions .hadolint.yaml
Original file line number Diff line number Diff line change
@@ -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 changes: 35 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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
6 changes: 3 additions & 3 deletions 0.14/Dockerfile
Original file line number Diff line number Diff line change
@@ -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 && \
Expand Down
2 changes: 1 addition & 1 deletion 0.14/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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")"
6 changes: 3 additions & 3 deletions 0.15/Dockerfile
Original file line number Diff line number Diff line change
@@ -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 \
Expand Down
4 changes: 2 additions & 2 deletions 0.16/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion 0.17/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
12 changes: 12 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -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 changes: 2 additions & 0 deletions lint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
git ls-files --exclude='*Dockerfile' --ignored | xargs --max-lines=1 ./hadolint

0 comments on commit 605ca74

Please sign in to comment.