Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make things parametrizeable #4

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# options: stable, unstable
TERASOLOGY_BUILD=stable
# options: latest or any release tag
TERASOLOGY_TAG=latest
9 changes: 4 additions & 5 deletions .github/workflows/dockerpublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
- name: Push image
run: |
IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/$IMAGE_NAME

# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')

Expand All @@ -71,16 +71,15 @@ jobs:

echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION

rm versionInfo.properties* || true

if [ " ${TERASOLOGY_PROPERTIES_URL}" == " " ]; then
if [ " ${TERASOLOGY_BUILD}" == " " ]; then
source .env
TERASOLOGY_PROPERTIES_URL=http://jenkins.terasology.org/job/TerasologyStable/lastSuccessfulBuild/artifact/build/resources/main/org/terasology/version/versionInfo.properties
TERASOLOGY_PROPERTIES_URL=http://jenkins.terasology.org/job/TerasologyStable/lastSuccessfulBuild/artifact/build/resources/main/org/terasology/version/versionInfo.properties
else
if [ " ${TERASOLOGY_BUILD}" == " unstable" ]; then
TERASOLOGY_PROPERTIES_URL=http://jenkins.terasology.org/job/Terasology/lastSuccessfulBuild/artifact/build/resources/main/org/terasology/version/versionInfo.properties
TERASOLOGY_PROPERTIES_URL=http://jenkins.terasology.org/job/Terasology/lastSuccessfulBuild/artifact/build/resources/main/org/terasology/version/versionInfo.properties
fi
fi
fi
Expand Down
21 changes: 19 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,27 @@
FROM ubuntu:18.04
MAINTAINER Marcel Otte <[email protected]>
RUN apt-get update && apt-get install -y openjdk-11-jre wget unzip

ARG TERASOLOGY_OMEGA_URL
ARG TERASOLOGY_BUILD

RUN apt-get update \
&& apt-get install -y openjdk-11-jre wget unzip \
&& apt-get clean \
&& rm -rf /var/cache/apt/archives \
&& rm -rf /var/lib/apt/lists/*

RUN mkdir /terasology \
&& wget -P /terasology http://jenkins.terasology.org/job/DistroOmegaRelease/lastSuccessfulBuild/artifact/distros/omega/build/distributions/TerasologyOmega.zip \
if [ " ${TERASOLOGY_OMEGA_URL}" == " " ]; then \
if [ " ${TERASOLOGY_BUILD}" == " stable" ]; then \
TERASOLOGY_OMEGA_URL=http://jenkins.terasology.org/job/DistroOmegaRelease/lastSuccessfulBuild/artifact/distros/omega/build/distributions/TerasologyOmega.zip \
else \
TERASOLOGY_OMEGA_URL=http://jenkins.terasology.org/job/DistroOmega/lastSuccessfulBuild/artifact/distros/omega/build/distributions/TerasologyOmega.zip \
fi \
fi \
&& wget -P /terasology ${TERASOLOGY_OMEGA_URL} \
&& unzip /terasology/TerasologyOmega.zip -d /terasology \
&& rm -f /terasology/TerasologyOmega.zip

ENTRYPOINT cd /terasology && java -jar /terasology/libs/Terasology.jar -headless -homedir=/terasology/server
VOLUME /terasology/server
EXPOSE 25777
27 changes: 20 additions & 7 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,32 @@

rm versionInfo.properties*

wget http://jenkins.terasology.org/job/TerasologyStable/lastSuccessfulBuild/artifact/build/resources/main/org/terasology/version/versionInfo.properties

if [ " ${TERASOLOGY_PROPERTIES_URL}" == " " ]; then
if [ " ${TERASOLOGY_BUILD}" == " " ]; then
source .env
TERASOLOGY_PROPERTIES_URL=http://jenkins.terasology.org/job/TerasologyStable/lastSuccessfulBuild/artifact/build/resources/main/org/terasology/version/versionInfo.properties
else
if [ " ${TERASOLOGY_BUILD}" == " unstable" ]; then
TERASOLOGY_PROPERTIES_URL=http://jenkins.terasology.org/job/Terasology/lastSuccessfulBuild/artifact/build/resources/main/org/terasology/version/versionInfo.properties
fi
fi
fi

wget ${TERASOLOGY_PROPERTIES_URL}

source versionInfo.properties

docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
# docker login -u $DOCKER_USER -p $DOCKER_PASSWORD

TAGNAME=$engineVersion-$displayVersion

docker build --no-cache -t qwick/terasology:$TAGNAME .

NEW_TAGNAME=latest

docker tag qwick/terasology:$TAGNAME qwick/terasology:$NEW_TAGNAME

docker push qwick/terasology:$TAGNAME
docker push qwick/terasology:$NEW_TAGNAME
if [ " ${TERASOLOGY_TAG}" == " latest" ]; then
NEW_TAGNAME=latest
docker tag qwick/terasology:$TAGNAME qwick/terasology:$NEW_TAGNAME

docker push qwick/terasology:$NEW_TAGNAME
fi
6 changes: 4 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
version: '2'
version: '3.7'
services:
terasology:
image: qwick/terasology:latest
build:
context: .
image: "qwick/terasology:${TERASOLOGY_TAG}"
ports:
- 25777:25777
volumes:
Expand Down