Skip to content

Commit

Permalink
Make things parametrizeable
Browse files Browse the repository at this point in the history
See: #2
  • Loading branch information
qwc committed Apr 14, 2020
1 parent eaf33e1 commit 2f62bca
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 10 deletions.
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
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
25 changes: 19 additions & 6 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,19 @@

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

Expand All @@ -12,9 +24,10 @@ 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

0 comments on commit 2f62bca

Please sign in to comment.