Skip to content

Commit

Permalink
Updates to support Anonymous install
Browse files Browse the repository at this point in the history
  • Loading branch information
Gulluth committed Feb 27, 2016
1 parent 10ec7a4 commit 73755f7
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 38 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.git
.git/*
7 changes: 6 additions & 1 deletion 7dtd-server.run
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
#!/bin/bash
docker run -d -p 8080:8080 -p 8081:8081 -p 26900:26900 -p 26901:26901 -p 26902:26902 --name="7dtd" 7dtd

if [ ! -d /tmp/livingdead ]; then
mkdir /tmp/livingdead
fi

docker run -d -p 8080:8080 -p 8081:8081 -p 26900:26900 -p 26901:26901 -p 26902:26902 --name="7dtd" --volume /home/livingdead/engine:/tmp/livingdead 7dtd
26 changes: 22 additions & 4 deletions 7dtd.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,26 @@
#!/bin/bash
set -e

PARAMS=$@
LIVINGDEAD_HOME=/opt/7dtd
LIVINGDEAD_HOME=/home/livingdead

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
cd $LIVINGDEAD_HOME

echo "Downloading Steam Cmd"
su -l livingdead -c "wget http://media.steampowered.com/installer/steamcmd_linux.tar.gz -O steamcmd_linux.tar.gz"
su -l livingdead -c "tar -zxf steamcmd_linux.tar.gz -C ./bin"

echo "Downloading 7 Days to Die Server"
su -l livingdead -c "mkdir -p ${LIVINGDEAD_HOME}/server"
su -l livingdead -c "${LIVINGDEAD_HOME}/bin/steamcmd.sh \
+login anonymous \
+force_install_dir ${LIVINGDEAD_HOME}/server \
+app_update 294420 \
+quit"

echo "Launching 7 Days to Die"
export LD_LIBRARY_PATH=$LIVINGDEAD_HOME/server
su -l livingdead -c "${LIVINGDEAD_HOME}/server/7DaysToDieServer.x86_64 \
-configfile=${LIVINGDEAD_HOME}/serverconfig.xml \
-logfile ${LIVINGDEAD_HOME}/server/output.log \
-quit -batchmode -nographics -dedicated $PARAMS"
44 changes: 11 additions & 33 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,45 +1,23 @@
FROM ubuntu:latest
FROM debian: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 \
RUN dpkg --add-architecture i386 && apt-get update && apt-get install -y \
lib32gcc1 \
wget \
xmlstarlet \
&& 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
RUN useradd -ms /bin/bash livingdead
WORKDIR /home/livingdead
COPY serverconfig.xml serverconfig.xml
COPY 7dtd.sh bin/7dtd
RUN chown -R livingdead:livingdead /home/livingdead

# 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"]
CMD ["/home/livingdead/bin/7dtd"]

0 comments on commit 73755f7

Please sign in to comment.