Browse Source

always restart and build when starting

Klumpp, Paul-Dieter 7 years ago
parent
commit
61899c0de8
4 changed files with 45 additions and 0 deletions
  1. 22 0
      Dockerfile
  2. 12 0
      docker-compose.yml
  3. 8 0
      entrypoint.sh
  4. 3 0
      run_docker_masterserver.sh

+ 22 - 0
Dockerfile

@@ -0,0 +1,22 @@
+# This is a Dockerfile that builds an image with a master server for quake, quake2 etc.
+# The master server part is from:
+# http://lasange-system.sourceforge.net/ 
+# https://sourceforge.net/projects/lasange-system/files/masterserver/
+
+# Because of fear losing the source we created a mirror of the master server
+# source that we use here to build the Docker image.
+
+FROM ubuntu
+
+RUN apt-get update && apt-get -y install apt-utils
+RUN apt-get -y install build-essential linux-headers-generic
+
+RUN mkdir -p /build
+RUN groupadd -r buildrun && useradd --uid 23176 -r -g buildrun buildrun
+
+ADD entrypoint.sh /build
+ADD src /build
+RUN chown -R buildrun:buildrun /build
+USER buildrun
+EXPOSE 27650 27000 28900 27900 27950 27951 27953
+ENTRYPOINT ["/build/entrypoint.sh"]

+ 12 - 0
docker-compose.yml

@@ -0,0 +1,12 @@
+version: "3"
+services:
+  masterserver:
+    restart: always
+    build: ./
+    image: lasange:masterserver
+    deploy:
+      replicas: 1
+      resources:
+        limits:
+          cpus: "0.2"
+          memory: 2500M

+ 8 - 0
entrypoint.sh

@@ -0,0 +1,8 @@
+#!/bin/bash
+set -e
+cd /build/masterserver
+make
+
+./masterserver -p ./plugins
+echo The masterserver stopped. 
+sleep 1

+ 3 - 0
run_docker_masterserver.sh

@@ -0,0 +1,3 @@
+#!/bin/bash
+docker-compose build && docker-compose up -d
+