mirror of
https://github.com/factoriotools/factorio-docker.git
synced 2025-07-01 14:38:05 +02:00
Compare commits
14 Commits
Author | SHA1 | Date | |
---|---|---|---|
4e261043cd | |||
4c47dbc4ee | |||
07264e626f | |||
64a1f8d9bf | |||
15a2d493f8 | |||
3777041d3e | |||
ccd0707d21 | |||
a5b03e6625 | |||
03b4d9eb5e | |||
af48272100 | |||
cc63e10cd1 | |||
f90cd27bcd | |||
1ab01d0277 | |||
66c11b1a82 |
@ -31,4 +31,4 @@ jobs:
|
||||
- <<: *build
|
||||
if: branch = master AND type != pull_request
|
||||
env:
|
||||
script: docker run -v $PWD:/workspace -e DOCKERHUB_USERNAME=$DOCKER_USERNAME -e DOCKERHUB_PASSWORD=$DOCKER_PASSWORD -e DOCKERHUB_REPOSITORY='factoriotools/factorio' -e README_FILEPATH='/workspace/README.md' peterevans/dockerhub-description:2.1.0
|
||||
script: DOCKERHUB_USERNAME=$DOCKER_USERNAME DOCKERHUB_PASSWORD=$DOCKER_PASSWORD DOCKERHUB_REPOSITORY='factoriotools/factorio' README_FILEPATH='./README.md' ./update-dockerhub-description.sh
|
||||
|
@ -1,4 +1,4 @@
|
||||
FROM frolvlad/alpine-glibc:alpine-3.9
|
||||
FROM frolvlad/alpine-glibc:alpine-3.11
|
||||
|
||||
LABEL maintainer="https://github.com/factoriotools/factorio-docker"
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
FROM frolvlad/alpine-glibc:alpine-3.9
|
||||
FROM frolvlad/alpine-glibc:alpine-3.11
|
||||
|
||||
LABEL maintainer="https://github.com/factoriotools/factorio-docker"
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
FROM frolvlad/alpine-glibc:alpine-3.9
|
||||
FROM frolvlad/alpine-glibc:alpine-3.11
|
||||
|
||||
LABEL maintainer="https://github.com/factoriotools/factorio-docker"
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
FROM frolvlad/alpine-glibc:alpine-3.9
|
||||
FROM frolvlad/alpine-glibc:alpine-3.11
|
||||
|
||||
LABEL maintainer="https://github.com/factoriotools/factorio-docker"
|
||||
|
||||
@ -19,6 +19,7 @@ ENV PORT=34197 \
|
||||
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 \
|
||||
@ -29,10 +30,12 @@ RUN set -ox pipefail \
|
||||
&& tar xf "$archive" --directory /opt \
|
||||
&& chmod ugo=rwx /opt/factorio \
|
||||
&& rm "$archive" \
|
||||
&& 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 \
|
||||
&& mkdir -p /opt/factorio/config/ \
|
||||
&& printf "\
|
||||
[path]\n\
|
||||
read-data=__PATH__executable__/../../data\n\
|
||||
write-data=/factorio\n\
|
||||
" >> /opt/factorio/config/config.ini \
|
||||
&& addgroup -g "$PGID" -S "$GROUP" \
|
||||
&& adduser -u "$PUID" -G "$GROUP" -s /bin/sh -SDH "$USER" \
|
||||
&& chown -R "$USER":"$GROUP" /opt/factorio /factorio
|
||||
|
@ -1,4 +1,4 @@
|
||||
FROM frolvlad/alpine-glibc:alpine-3.9
|
||||
FROM frolvlad/alpine-glibc:alpine-3.11
|
||||
|
||||
LABEL maintainer="https://github.com/factoriotools/factorio-docker"
|
||||
|
||||
@ -9,8 +9,8 @@ ARG PGID=845
|
||||
|
||||
ENV PORT=34197 \
|
||||
RCON_PORT=27015 \
|
||||
VERSION=0.18.20 \
|
||||
SHA1=452e6acf0dedca4a6dfe0e64ede1c8d0cc8adb39 \
|
||||
VERSION=0.18.24 \
|
||||
SHA1=04f9aa9b93eaf220d55447201cb10f96e325e073 \
|
||||
SAVES=/factorio/saves \
|
||||
CONFIG=/factorio/config \
|
||||
MODS=/factorio/mods \
|
||||
@ -19,6 +19,7 @@ ENV PORT=34197 \
|
||||
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 \
|
||||
@ -29,10 +30,12 @@ RUN set -ox pipefail \
|
||||
&& tar xf "$archive" --directory /opt \
|
||||
&& chmod ugo=rwx /opt/factorio \
|
||||
&& rm "$archive" \
|
||||
&& 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 \
|
||||
&& mkdir -p /opt/factorio/config/ \
|
||||
&& printf "\
|
||||
[path]\n\
|
||||
read-data=__PATH__executable__/../../data\n\
|
||||
write-data=/factorio\n\
|
||||
" >> /opt/factorio/config/config.ini \
|
||||
&& addgroup -g "$PGID" -S "$GROUP" \
|
||||
&& adduser -u "$PUID" -G "$GROUP" -s /bin/sh -SDH "$USER" \
|
||||
&& chown -R "$USER":"$GROUP" /opt/factorio /factorio
|
||||
|
10
README.md
10
README.md
@ -1,6 +1,6 @@
|
||||
# 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")
|
||||
|
||||
* `0.18.20`, `0.18`, `latest` [(0.18/Dockerfile)](https://github.com/factoriotools/factorio-docker/blob/master/0.18/Dockerfile)
|
||||
* `0.18.24`, `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)
|
||||
@ -118,22 +118,22 @@ sudo docker run -d \
|
||||
-p 34197:34197/udp \
|
||||
-p 27015:27015/tcp \
|
||||
-v /opt/factorio:/factorio \
|
||||
-e ENABLE_SERVER_LOAD_LATEST=false \
|
||||
-e LOAD_LATEST_SAVE=false \
|
||||
-e SAVE_NAME=replaceme \
|
||||
--name factorio \
|
||||
--restart=always \
|
||||
factoriotools/factorio
|
||||
```
|
||||
|
||||
To generate a new map set `ENABLE_GENERATE_NEW_MAP_SAVE=true` and specify `SAVE_NAME`:
|
||||
To generate a new map set `GENERATE_NEW_SAVE=true` and specify `SAVE_NAME`:
|
||||
|
||||
```shell
|
||||
sudo docker run -d \
|
||||
-p 34197:34197/udp \
|
||||
-p 27015:27015/tcp \
|
||||
-v /opt/factorio:/factorio \
|
||||
-e ENABLE_SERVER_LOAD_LATEST=false \
|
||||
-e ENABLE_GENERATE_NEW_MAP_SAVE=true \
|
||||
-e LOAD_LATEST_SAVE=false \
|
||||
-e GENERATE_NEW_SAVE=true \
|
||||
-e SAVE_NAME=replaceme \
|
||||
--name factorio \
|
||||
--restart=always \
|
||||
|
16
build.sh
16
build.sh
@ -27,8 +27,10 @@ else
|
||||
elif [[ $VERSION == "${TRAVIS_BRANCH%-*}" ]]; then
|
||||
TAGS="-t $DOCKER_REPO:$TRAVIS_BRANCH -t $DOCKER_REPO:$VERSION -t $DOCKER_REPO:$VERSION_SHORT"
|
||||
# we build a other branch than master
|
||||
elif [[ -n $TRAVIS_BRANCH ]]; then
|
||||
TAGS="-t $DOCKER_REPO:$TRAVIS_BRANCH"
|
||||
# disabled for now cause it breaks Travis CI builds of dependabot
|
||||
# https://travis-ci.org/github/factoriotools/factorio-docker/jobs/688176474#L182
|
||||
# elif [[ -n $TRAVIS_BRANCH ]]; then
|
||||
# TAGS="-t $DOCKER_REPO:$TRAVIS_BRANCH"
|
||||
fi
|
||||
else
|
||||
# we are not in CI and tag version and version short
|
||||
@ -68,13 +70,15 @@ if [[ $(dirname "$(git diff --name-only HEAD^)") =~ $VERSION_SHORT ]] && [[ ${TR
|
||||
fi
|
||||
|
||||
# push a tag on a branch other than master
|
||||
if [[ -n ${TRAVIS_BRANCH:-} ]] && [[ $VERSION != "${TRAVIS_BRANCH_VERSION:-}" ]] && [[ ${TRAVIS_BRANCH:-} != "master" ]]; then
|
||||
docker push "$DOCKER_REPO:$TRAVIS_BRANCH"
|
||||
fi
|
||||
# disabled for now cause it breaks Travis CI builds of dependabot
|
||||
# https://travis-ci.org/github/factoriotools/factorio-docker/jobs/688176474#L182
|
||||
# if [[ -n ${TRAVIS_BRANCH:-} ]] && [[ $VERSION != "${TRAVIS_BRANCH_VERSION:-}" ]] && [[ ${TRAVIS_BRANCH:-} != "master" ]]; then
|
||||
# docker push "$DOCKER_REPO:$TRAVIS_BRANCH"
|
||||
# fi
|
||||
|
||||
# push an incremental tag
|
||||
if [[ $VERSION == "${TRAVIS_BRANCH_VERSION:-}" ]]; then
|
||||
docker push "$DOCKER_REPO:$TRAVIS_BRANCH"
|
||||
docker push "$DOCKER_REPO:$VERSION"
|
||||
fi
|
||||
|
||||
if [[ -n ${TRAVIS_TAG:-} ]] || [[ -z ${CI:-} ]]; then
|
||||
|
35
update-dockerhub-description.sh
Executable file
35
update-dockerhub-description.sh
Executable file
@ -0,0 +1,35 @@
|
||||
#!/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