diff --git a/Dockerfile b/Dockerfile index 77e9cfd..01360ed 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,13 +7,20 @@ ENV TEAMSPEAK_VERSION=3.13.7 \ TEAMSPEAK_SHA256=775a5731a9809801e4c8f9066cd9bc562a1b368553139c1249f2a0740d50041e RUN apt-get update \ - && apt-get install -y curl bzip2 ca-certificates dumb-init --no-install-recommends \ + && apt-get install --no-install-recommends -y \ + bzip2 \ + ca-certificates \ + curl \ + dumb-init \ && curl -sSfLo teamspeak3-server_linux-amd64.tar.bz2 \ - "https://files.teamspeak-services.com/releases/server/${TEAMSPEAK_VERSION}/teamspeak3-server_linux_amd64-${TEAMSPEAK_VERSION}.tar.bz2" \ + "https://files.teamspeak-services.com/releases/server/${TEAMSPEAK_VERSION}/teamspeak3-server_linux_amd64-${TEAMSPEAK_VERSION}.tar.bz2" \ && echo "${TEAMSPEAK_SHA256} *teamspeak3-server_linux-amd64.tar.bz2" | sha256sum -c - \ && tar -C /opt -xjf teamspeak3-server_linux-amd64.tar.bz2 \ && rm teamspeak3-server_linux-amd64.tar.bz2 \ - && apt-get purge -y curl bzip2 && apt-get autoremove -y \ + && apt-get purge -y \ + bzip2 \ + curl \ + && apt-get autoremove -y \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* \ && groupadd -g 1000 teamspeak \ diff --git a/docker-ts3.sh b/docker-ts3.sh index 9cec195..f490955 100755 --- a/docker-ts3.sh +++ b/docker-ts3.sh @@ -1,46 +1,46 @@ #!/bin/bash set -euo pipefail +function log() { + echo "[$(date +%H:%M:%S)] $@" >&2 +} + VOLUME=/teamspeak3 if [ -e "${VOLUME}/.ts3server_license_accepted" ]; then - echo "- Accepting license as you requested" - touch /opt/teamspeak3-server_linux_amd64/.ts3server_license_accepted + log "- Accepting license as you requested" + touch /opt/teamspeak3-server_linux_amd64/.ts3server_license_accepted fi -echo "- Linking host mounted database..." - if ! [ -L /opt/teamspeak3-server_linux_amd64/ts3server.sqlitedb ]; then - ln -s $VOLUME/ts3server.sqlitedb /opt/teamspeak3-server_linux_amd64/ts3server.sqlitedb + log "- Linking host mounted database..." + ln -s ${VOLUME}/ts3server.sqlitedb /opt/teamspeak3-server_linux_amd64/ts3server.sqlitedb fi -echo "- Link the files-folder into the host-mounted volume..." - mkdir -p ${VOLUME}/files if ! [ -L /opt/teamspeak3-server_linux_amd64/files ]; then - rm -rf /opt/teamspeak3-server_linux_amd64/files - ln -s ${VOLUME}/files /opt/teamspeak3-server_linux_amd64/files + log "- Link the files-folder into the host-mounted volume..." + rm -rf /opt/teamspeak3-server_linux_amd64/files + ln -s ${VOLUME}/files /opt/teamspeak3-server_linux_amd64/files fi -echo "- Starting TS3-Server..." +log "- Starting TS3-Server..." if [ -f "${VOLUME}/ts3server.ini" ]; then - echo " '${VOLUME}/ts3server.ini' found. Using as config file." - echo " HINT: If this ini was transfered from another ts3-install you may want" - echo " to make sure the following settings are active for the usage of host-mounted volume:" - echo " - query_ip_whitelist='${VOLUME}/query_ip_whitelist.txt'" - echo " - query_ip_backlist='${VOLUME}/query_ip_blacklist.txt'" - echo " - logpath='${VOLUME}/logs/'" - echo " - licensepath='${VOLUME}/'" - echo " - inifile='${VOLUME}/ts3server.ini'" - /opt/teamspeak3-server_linux_amd64/ts3server_minimal_runscript.sh \ - inifile="${VOLUME}/ts3server.ini" + log " '${VOLUME}/ts3server.ini' found. Using as config file." + log " HINT: If this ini was transfered from another ts3-install you may want" + log " to make sure the following settings are active for the usage of host-mounted volume:" + log " - query_ip_whitelist='${VOLUME}/query_ip_whitelist.txt'" + log " - logpath='${VOLUME}/logs/'" + log " - licensepath='${VOLUME}/'" + log " - inifile='${VOLUME}/ts3server.ini'" + /opt/teamspeak3-server_linux_amd64/ts3server_minimal_runscript.sh \ + inifile="${VOLUME}/ts3server.ini" else - echo " '${VOLUME}/ts3server.ini' not found. Creating new config file." - /opt/teamspeak3-server_linux_amd64/ts3server_minimal_runscript.sh \ - createinifile=1 \ - inifile="${VOLUME}/ts3server.ini" \ - licensepath="${VOLUME}/" \ - logpath="${VOLUME}/logs/" \ - query_ip_backlist="${VOLUME}/query_ip_blacklist.txt" \ - query_ip_whitelist="${VOLUME}/query_ip_whitelist.txt" + log " '${VOLUME}/ts3server.ini' not found. Creating new config file." + /opt/teamspeak3-server_linux_amd64/ts3server_minimal_runscript.sh \ + createinifile=1 \ + inifile="${VOLUME}/ts3server.ini" \ + licensepath="${VOLUME}/" \ + logpath="${VOLUME}/logs/" \ + query_ip_allowlist="${VOLUME}/query_ip_whitelist.txt" fi