diff --git a/Dockerfile b/Dockerfile index e9dd9d7..ce1ff59 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,13 @@ -FROM phusion/passenger-nodejs:0.9.17 +FROM node:4.2 ENV TS3CLIENT_VERSION 3.0.18.2 -ENV TS3BOT_COMMIT 82c19a2196770c463d8c94fc9e5842dfe8697c8d +ENV TS3BOT_COMMIT 4d7550865e59a95e7bae73f2c1fd7f99ecdfb8a0 + +# Add "app" user +RUN mkdir -p /tmp/empty &&\ + groupadd -g 9999 app &&\ + useradd -d /home/app -l -N -g app -m -k /tmp/empty -u 9999 app &&\ + rmdir /tmp/empty ADD setup.sh / RUN sh /setup.sh @@ -11,4 +17,5 @@ COPY etc/ /etc # Startup configuration WORKDIR /home/app -ENTRYPOINT [ "/sbin/my_init" ] +USER app +CMD [ "node", "/home/app/ts3bot", "--ts3-install-path=/home/app/ts3client" ] diff --git a/etc/pulse/default.pa b/etc/pulse/default.pa new file mode 100644 index 0000000..02341e5 --- /dev/null +++ b/etc/pulse/default.pa @@ -0,0 +1,30 @@ +.fail + +# Set tsched=0 here if you experience glitchy playback. This will +# revert back to interrupt-based scheduling and should fix it. + +# Audio sinks +load-module module-rescue-streams +load-module module-always-sink +load-module module-null-sink sink_name="TS3Bot" sink_properties=device.description="TS3Bot" + +# Restore +load-module module-device-restore +load-module module-stream-restore + +# Accept clients -- very important +load-module module-native-protocol-unix + +.ifexists module-x11-publish.so + # Publish to X11 so the clients know how to connect to Pulse. Will + # clear itself on unload. + load-module module-x11-publish +.endif + +.nofail + +# Suspend on idle +load-module module-suspend-on-idle + +# Filters... will we ever need them? +load-module module-filter-apply \ No newline at end of file diff --git a/setup.sh b/setup.sh index 0aaee09..b1d2093 100644 --- a/setup.sh +++ b/setup.sh @@ -6,48 +6,36 @@ set -ex export INITRD=no export DEBIAN_FRONTEND=noninteractive -# Get rid of some preinstalled services we don't need -rm -r /etc/service/cron /etc/service/nginx /etc/service/nginx-log-forwarder - -# Set up APT sources -rm /etc/apt/sources.list.d/* - # Now install all packages we need apt-get update apt-get install -y --no-install-recommends \ wget ca-certificates \ blackbox xvfb xdotool \ pulseaudio pulseaudio-utils \ - dbus \ cmake cmake-data \ python python-minimal python-pkg-resources \ vlc-nox '^libvlc[0-9]+$' libvlc-dev vlc-plugin-pulse -# DBus initialization -mkdir -p /var/run/dbus -chown messagebus:messagebus /var/run/dbus -dbus-uuidgen --ensure - # Configure GUI user, we are going to use the pre-setup "app" user for this mkdir -p /config -/sbin/setuser app ln -sf /config ~app/.ts3bot +ln -sf /config ~app/.ts3bot # Install TeamSpeak3. # Original comment that used to be here: temporary non-interactive teamspeak3 install hack, remove before publishing!! # In fact, it would be nice if we had some lazy handling code for this that just requires the user to provide a "--agree-with-license" once. cd ~app -/sbin/setuser app wget http://dl.4players.de/ts/releases/${TS3CLIENT_VERSION}/TeamSpeak3-Client-linux_amd64-${TS3CLIENT_VERSION}.run -Ots3client.run +wget http://dl.4players.de/ts/releases/${TS3CLIENT_VERSION}/TeamSpeak3-Client-linux_amd64-${TS3CLIENT_VERSION}.run -Ots3client.run chmod +x ./ts3client.run sed -i 's/^MS_PrintLicense$/#MS_PrintLicense/g' ./ts3client.run -/sbin/setuser app ./ts3client.run --quiet --target ts3client +./ts3client.run --quiet --target ts3client rm ./ts3client.run # Install TS3Bot wget https://github.com/icedream/ts3bot-control/archive/${TS3BOT_COMMIT}.tar.gz -O- |\ - /sbin/setuser app tar xzv + tar xzv mv ts3bot-control* ts3bot (cd ts3bot && \ - npm_config_wcjs_runtime="node" npm_config_wcjs_runtime_version="$(nodejs --version | tr -d 'v')" \ + npm_config_wcjs_runtime="node" npm_config_wcjs_runtime_version="$(node --version | tr -d 'v')" \ npm install) # Install youtube-dl (actually done by npm already in a non-system-wide way)