aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoïc Blot <nerzhul@users.noreply.github.com>2018-12-12 00:00:08 +0100
committerGitHub <noreply@github.com>2018-12-12 00:00:08 +0100
commitca141ed49101cd1ec42ae358e29f2ea7317c72b4 (patch)
tree544c0a8135b02fb1694fa4cea82ac3d478daf9ab
parentce32a327ff6e4e6810a9377e67eaeb47940b7c4c (diff)
downloadminetest-ca141ed49101cd1ec42ae358e29f2ea7317c72b4.tar.gz
minetest-ca141ed49101cd1ec42ae358e29f2ea7317c72b4.tar.bz2
minetest-ca141ed49101cd1ec42ae358e29f2ea7317c72b4.zip
Add a Dockerfile + gitlab CI build (#7968)
* Add a minetest docker file * Clone minetest_game from git directly
-rw-r--r--.gitlab-ci.yml13
-rw-r--r--Dockerfile40
2 files changed, 53 insertions, 0 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index e0d687134..abef1835c 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -10,6 +10,7 @@ stages:
variables:
MINETEST_GAME_REPO: "https://github.com/minetest/minetest_game.git"
+ CONTAINER_IMAGE: registry.gitlab.com/$CI_PROJECT_PATH
.build_template: &build_definition
stage: build
@@ -308,3 +309,15 @@ package:win64:
NO_PACKAGE: "1"
WIN_ARCH: "x86_64"
TOOLCHAIN_OUTPUT: "util/buildbot/toolchain_mingw64.cmake"
+
+package:docker:
+ stage: package
+ image: docker:stable
+ services:
+ - docker:dind
+ before_script:
+ - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN registry.gitlab.com
+ script:
+ - docker build . -t ${CONTAINER_IMAGE}/minetestserver:$CI_COMMIT_REF_NAME -t ${CONTAINER_IMAGE}/minetestserver:latest
+ - docker push ${CONTAINER_IMAGE}/minetestserver:$CI_COMMIT_REF_NAME
+ - docker push ${CONTAINER_IMAGE}/minetestserver:latest
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 000000000..27734119e
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,40 @@
+FROM debian:stretch
+
+USER root
+RUN apt-get update -y && \
+ apt-get -y install build-essential libirrlicht-dev cmake libbz2-dev libpng-dev libjpeg-dev \
+ libsqlite3-dev libcurl4-gnutls-dev zlib1g-dev libgmp-dev libjsoncpp-dev git && \
+ apt-get clean && rm -rf /var/cache/apt/archives/* && \
+ rm -rf /var/lib/apt/lists/*
+
+COPY . /usr/src/minetest
+
+RUN mkdir -p /usr/src/minetest/cmakebuild && cd /usr/src/minetest/cmakebuild && \
+ cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Release -DRUN_IN_PLACE=FALSE \
+ -DBUILD_SERVER=TRUE \
+ -DBUILD_CLIENT=FALSE \
+ -DENABLE_SYSTEM_JSONCPP=1 \
+ .. && \
+ make -j2 && \
+ rm -Rf ../games/minetest_game && git clone https://github.com/minetest/minetest_game ../games/minetest_game && \
+ make install
+
+FROM debian:stretch
+
+USER root
+RUN groupadd minetest && useradd -m -g minetest -d /var/lib/minetest minetest && \
+ apt-get update -y && \
+ apt-get -y install libcurl3-gnutls libjsoncpp1 liblua5.1-0 libluajit-5.1-2 libpq5 libsqlite3-0 \
+ libstdc++6 zlib1g libc6
+
+WORKDIR /var/lib/minetest
+
+COPY --from=0 /usr/local/share/minetest /usr/local/share/minetest
+COPY --from=0 /usr/local/bin/minetestserver /usr/local/bin/minetestserver
+COPY --from=0 /usr/local/share/doc/minetest/minetest.conf.example /etc/minetest/minetest.conf
+
+USER minetest
+
+EXPOSE 30000/udp
+
+CMD ["/usr/local/bin/minetestserver", "--config", "/etc/minetest/minetest.conf"]