mirror of
https://github.com/factoriotools/factorio-docker.git
synced 2025-07-01 14:38:05 +02:00
Compare commits
28 Commits
Author | SHA1 | Date | |
---|---|---|---|
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 |
18
.github/workflows/docker-description.yml
vendored
Normal file
18
.github/workflows/docker-description.yml
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
name: Docker build & push
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: master
|
||||
|
||||
jobs:
|
||||
docker-description:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Docker Hub Description
|
||||
uses: peter-evans/dockerhub-description@v2.4.1
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
repository: factoriotools/factorio
|
53
.github/workflows/docker.yml
vendored
Normal file
53
.github/workflows/docker.yml
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
name: Docker build & push
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches: master
|
||||
tags:
|
||||
- '*'
|
||||
|
||||
jobs:
|
||||
old-version:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
version: [ "1.0", "0.18", "0.17", "0.16", "0.15", "0.14" ]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: build
|
||||
env:
|
||||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
||||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
||||
VERSION_SHORT: ${{ matrix.version }}
|
||||
run: |
|
||||
./build.sh ${{ matrix.version }}
|
||||
|
||||
stable:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: build
|
||||
env:
|
||||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
||||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
||||
EXTRA_TAG: stable,latest
|
||||
VERSION_SHORT: "1.1"
|
||||
run: |
|
||||
./build.sh $VERSION_SHORT
|
||||
|
||||
# experimental:
|
||||
# runs-on: ubuntu-latest
|
||||
# steps:
|
||||
# - name: Checkout
|
||||
# uses: actions/checkout@v2
|
||||
# - name: build
|
||||
# env:
|
||||
# DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
||||
# DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
||||
# EXTRA_TAG: latest
|
||||
# VERSION_SHORT: "1.2"
|
||||
# run: |
|
||||
# ./build.sh $VERSION_SHORT
|
27
.github/workflows/lint.yml
vendored
Normal file
27
.github/workflows/lint.yml
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
name: 'Linter'
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches: master
|
||||
|
||||
jobs:
|
||||
shellcheck:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: shellcheck
|
||||
uses: reviewdog/action-shellcheck@v1
|
||||
with:
|
||||
github_token: ${{ secrets.github_token }}
|
||||
reporter: github-pr-review
|
||||
|
||||
hadolint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: hadolint
|
||||
uses: reviewdog/action-hadolint@v1
|
||||
with:
|
||||
github_token: ${{ secrets.github_token }}
|
||||
reporter: github-pr-review
|
40
.travis.yml
40
.travis.yml
@ -1,40 +0,0 @@
|
||||
dist: xenial
|
||||
language: bash
|
||||
services:
|
||||
- docker
|
||||
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- jq
|
||||
|
||||
jobs:
|
||||
include:
|
||||
- stage: test
|
||||
script:
|
||||
# Travis gets rate limited by Docker HUB.
|
||||
- |
|
||||
[[ -n $DOCKER_PASSWORD && -n $DOCKER_USERNAME ]] && echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
|
||||
- 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=1.1 EXTRA_TAG=latest
|
||||
script:
|
||||
- ./build.sh $VERSION_SHORT
|
||||
- <<: *build
|
||||
env: VERSION_SHORT=1.0 EXTRA_TAG=stable
|
||||
- <<: *build
|
||||
env: VERSION_SHORT=0.18
|
||||
- <<: *build
|
||||
env: VERSION_SHORT=0.17
|
||||
- <<: *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
|
||||
script: DOCKERHUB_USERNAME=$DOCKER_USERNAME DOCKERHUB_PASSWORD=$DOCKER_PASSWORD DOCKERHUB_REPOSITORY='factoriotools/factorio' README_FILEPATH='./README.md' ./update-dockerhub-description.sh
|
@ -9,8 +9,8 @@ ARG PGID=845
|
||||
|
||||
ENV PORT=34197 \
|
||||
RCON_PORT=27015 \
|
||||
VERSION=1.1.18 \
|
||||
SHA1=28e7058a065cd86a9d02b077b99d076bca7e6d36 \
|
||||
VERSION=1.1.22 \
|
||||
SHA1=992bdf7b5d1ad8b8a9accd1af51e69c98ae61102 \
|
||||
SAVES=/factorio/saves \
|
||||
CONFIG=/factorio/config \
|
||||
MODS=/factorio/mods \
|
||||
|
@ -1,7 +1,7 @@
|
||||
# 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")
|
||||
|
||||
* `1.1.18`, `1.1`, `latest` [(1.1/Dockerfile)](https://github.com/factoriotools/factorio-docker/blob/master/1.1/Dockerfile)
|
||||
* `1.0.0`, `1.0`, `stable` [(1.0/Dockerfile)](https://github.com/factoriotools/factorio-docker/blob/master/1.0/Dockerfile)
|
||||
* `1.1.22`, `1.1`, `latest`, `stable` [(1.1/Dockerfile)](https://github.com/factoriotools/factorio-docker/blob/master/1.1/Dockerfile)
|
||||
* `1.0.0`, `1.0` [(1.0/Dockerfile)](https://github.com/factoriotools/factorio-docker/blob/master/1.0/Dockerfile)
|
||||
* `0.18.47`, `0.18` [(0.18/Dockerfile)](https://github.com/factoriotools/factorio-docker/blob/master/0.18/Dockerfile)
|
||||
* `0.17.79`, `0.17` [(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)
|
||||
|
34
build.sh
34
build.sh
@ -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
|
||||
@ -48,7 +50,7 @@ else
|
||||
fi
|
||||
|
||||
# Travis gets rate limited by Docker HUB.
|
||||
if [[ ${CI:-} == true && -n $DOCKER_PASSWORD && -n $DOCKER_USERNAME ]]; then
|
||||
if [[ ${CI:-} == true && -n ${DOCKER_PASSWORD:-} && -n ${DOCKER_USERNAME:-} ]]; then
|
||||
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
|
||||
fi
|
||||
|
||||
@ -58,13 +60,13 @@ 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
|
||||
|
||||
@ -73,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
|
||||
|
@ -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
|
Reference in New Issue
Block a user