From 2561dd41ffc68d040b50b6609d27f67a4f8c3128 Mon Sep 17 00:00:00 2001 From: Martin Date: Mon, 26 Oct 2015 10:52:10 +0100 Subject: [PATCH] Initial commit --- Dockerfile | 84 +++++++++++++++++++++++++++++++++++++++++ build.sh | 5 +++ install.sh | 30 +++++++++++++++ space-engineers.service | 25 ++++++++++++ 4 files changed, 144 insertions(+) create mode 100644 Dockerfile create mode 100755 build.sh create mode 100755 install.sh create mode 100644 space-engineers.service diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..47a8652 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,84 @@ +# Space Engineers on Linux +# Dockerfile based on original work by webanck. +# See https://github.com/webanck/docker-wine-steam + +FROM ubuntu:14.04 +MAINTAINER Martin Røed Jacobsen + +# Creating the wine user and setting up dedicated non-root environment. +# Replace 1001 by your user id (id -u) for X sharing. +RUN useradd -u 109 -d /home/wine -m -s /bin/bash wine +ENV HOME /home/wine +WORKDIR /home/wine + +# Setting up the wineprefix to force 32 bit architecture. +ENV WINEPREFIX /home/wine/.wine +ENV WINEARCH win32 + +# Disabling warning messages from wine, comment for debug purpose. +ENV WINEDEBUG -all + +######################### START INSTALLATIONS ########################## + +# Disable interaction from package installation during the docker image building. +ENV DEBIAN_FRONTEND noninteractive + +# We want the 32 bits version of wine allowing winetricks. +RUN dpkg --add-architecture i386 && \ + +# Set the time zone. + echo "Europe/Oslo" > /etc/timezone && \ + dpkg-reconfigure -f noninteractive tzdata && \ + +# Updating and upgrading a bit. + apt-get update && \ + apt-get upgrade -y && \ + +# We need software-properties-common to add ppas. + apt-get install -y --no-install-recommends software-properties-common && \ + +# Add the wine PPA. + add-apt-repository ppa:ubuntu-wine/ppa && \ + apt-get update && \ + +# Installation of win, winetricks and temporary xvfb to install winetricks tricks during docker build. + apt-get install -y --no-install-recommends wine1.7 winetricks xvfb && \ + +# Installation of winbind to stop ntlm error messages. + apt-get install -y --no-install-recommends winbind && \ + +# Installation of winetricks tricks as wine user. + su -p -l wine -c winecfg && \ + su -p -l wine -c 'xvfb-run -a winetricks -q corefonts' && \ + su -p -l wine -c 'xvfb-run -a winetricks -q dotnet20' && \ + su -p -l wine -c 'xvfb-run -a winetricks -q dotnet40' && \ + su -p -l wine -c 'xvfb-run -a winetricks -q xna40' && \ + su -p -l wine -c 'xvfb-run -a winetricks d3dx9' && \ + su -p -l wine -c 'xvfb-run -a winetricks -q directplay' && \ + +# Installation of git, build tools and sigmap. + apt-get install -y --no-install-recommends build-essential git-core && \ + git clone https://github.com/marjacob/sigmap.git && \ + (cd sigmap && exec make) && \ + install sigmap/bin/sigmap /usr/local/bin/sigmap && \ + rm -rf sigmap/ && \ + +# Cleaning up. + apt-get autoremove -y --purge build-essential git-core && \ + apt-get autoremove -y --purge software-properties-common && \ + apt-get autoremove -y --purge xvfb && \ + apt-get autoremove -y --purge && \ + apt-get clean -y && \ + rm -rf /home/wine/.cache && \ + rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +######################### END OF INSTALLATIONS ########################## + +# Add the dedicated server files. +ADD install.sh /install.sh +RUN /install.sh && rm /install.sh + +# Launching the server as the wine user. +USER wine +ENTRYPOINT ["/usr/local/bin/sigmap", "-m 15:2", "/usr/local/bin/space-engineers-server", "-noconsole"] +CMD [""] diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..a75a410 --- /dev/null +++ b/build.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +build_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +(cd "${build_dir}" && exec docker build -t saiban/space-engineers .) diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..385fa99 --- /dev/null +++ b/install.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +# wine +wine_home="/home/wine/.wine/drive_c/users/wine" +wine_appdata="${wine_home}/Application Data" + +# space engineers +se_home="${wine_home}/DedicatedServer" +se_appdata="${wine_appdata}/SpaceEngineersDedicated" + +# entry point +entry_point="/usr/local/bin/space-engineers-server" + +# installation +cat << EOF > ${entry_point} +#!/usr/bin/env bash + +unzip -qq "/host/DedicatedServer.zip" -d "${wine_home}/" +ln -s "/host/Space Engineers" "${se_appdata}" + +chown -R wine:wine \ + "${se_appdata}/SpaceEngineers-Dedicated.cfg" \ + "${se_home}" + +exec wine "${se_home}/SpaceEngineersDedicated.exe" "\$@" +EOF + +chmod u+x "${entry_point}" +chown -R wine:wine "${entry_point}" + diff --git a/space-engineers.service b/space-engineers.service new file mode 100644 index 0000000..d3ca2de --- /dev/null +++ b/space-engineers.service @@ -0,0 +1,25 @@ +[Unit] +Description = Space Engineers +Requires = docker.service +After = docker.service + +[Service] +User = saiban +Group = saiban + +Restart = always +StandardInput = null +StandardOutput = journal +StandardError = journal + +ExecStart = /usr/bin/docker run -t \ + -p 27016:27016/udp \ + -v /home/saiban/games/space-engineers:/host \ + --name space_engineers_server \ + saiban/space-engineers +ExecStop = /usr/bin/docker stop space_engineers_server ; \ + /usr/bin/docker rm -f space_engineers_server ; \ + /bin/chmod 666 /dev/null + +[Install] +WantedBy = local.target