diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..335d8ad --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +serverconfig.xml diff --git a/7dtd-server.run b/7dtd-server.run new file mode 100755 index 0000000..1cda08f --- /dev/null +++ b/7dtd-server.run @@ -0,0 +1,2 @@ +#!/bin/bash +docker run -d -p 8080:8080 -p 8081:8081 -p 26900:26900 -p 26901:26901 -p 26902:26902 --name="7dtd" 7dtd diff --git a/7dtd.sh b/7dtd.sh new file mode 100755 index 0000000..50d4130 --- /dev/null +++ b/7dtd.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +PARAMS=$@ +LIVINGDEAD_HOME=/opt/7dtd + +cd $LIVINGDEAD_HOME/engine +export LD_LIBRARY_PATH=$LIVINGDEAD_HOME/engine/ +./7DaysToDieServer.x86 -configfile=serverconfig.xml -logfile $LIVINGDEAD_HOME/engine/output.log -quit -batchmode -nographics -dedicated $PARAMS diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d0917a4 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,45 @@ +FROM ubuntu:latest + +MAINTAINER mudfly + +ARG STEAM_USER +ARG STEAM_PASS +ARG STEAM_GUARD +ENV LIVINGDEAD_HOME /opt/7dtd + +# Install dependencies +RUN apt-get update \ +&& apt-get install -y \ +lib32gcc1 \ +wget \ +xmlstarlet \ +&& groupadd --system flesh && useradd --system --gid flesh --home /opt/7dtd --shell /bin/bash rotting \ +&& apt-get clean \ +&& rm -rf /var/lib/apt/lists/* + +WORKDIR $LIVINGDEAD_HOME + +# Gets SteamCMD +RUN wget http://media.steampowered.com/installer/steamcmd_linux.tar.gz \ +&& tar -xzf steamcmd_linux.tar.gz \ +&& rm steamcmd_linux.tar.gz \ +&& chown -R rotting:flesh /opt/7dtd + +# Install 7dtd +RUN ./steamcmd.sh +login $STEAM_USER $STEAM_PASS $STEAM_GUARD +force_install_dir ./engine/ +app_update 294420 validate +quit \ +&& chown -R rotting:flesh /opt/7dtd + +# Creates 7dtd server as a service +ADD ./serverconfig.xml $LIVINGDEAD_HOME/engine/serverconfig.xml +RUN chown rotting:flesh /opt/7dtd/engine/serverconfig.xml +ADD ./7dtd.sh $LIVINGDEAD_HOME/bin/7dtd +RUN chown -R rotting:flesh /opt/7dtd/bin + +# Expose the default 7dtd server port +EXPOSE 8080/tcp 8081/tcp +EXPOSE 26900 26901 26902 + +USER rotting +VOLUME $LIVINGDEAD_HOME + +CMD ["/opt/7dtd/bin/7dtd"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..51becc5 --- /dev/null +++ b/README.md @@ -0,0 +1,10 @@ +#Docker file for a 7 Days To Die Server + +##Maintainers +Mudfly + +##Build and Run Server +1. Clone this repository, and change into the directory +2. Copy `server.xml.example` to `server.xml`, and edit to your linking +3. Build the Docker image `docker build --build-arg STEAM_USER= --build-arg STEAM_PASS= --build-arg STEAM_GUARD= -t 7dtd .` +4. Start the 7 Days To Die server `./7dtd-server.run` diff --git a/license b/license new file mode 100644 index 0000000..585886c --- /dev/null +++ b/license @@ -0,0 +1,9 @@ +The MIT License (MIT) + +Copyright (c) 2016 Mudfly + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/serverconfig.xml.example b/serverconfig.xml.example new file mode 100644 index 0000000..27355c2 --- /dev/null +++ b/serverconfig.xml.example @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +