mirror of https://github.com/icedream/ts3bot.git
Attempt on optimizing Docker image.
parent
6dc8e72927
commit
8e312f9e5d
21
Dockerfile
21
Dockerfile
|
@ -1,6 +1,14 @@
|
||||||
FROM node:7.10.0
|
FROM node:7.10.0
|
||||||
|
|
||||||
ARG TS3CLIENT_VERSION=3.0.19.4
|
# Install runtime packages
|
||||||
|
RUN apt-get update &&\
|
||||||
|
export INITRD=no &&\
|
||||||
|
export DEBIAN_FRONTEND=noninteractive &&\
|
||||||
|
apt-get install -y --no-install-recommends \
|
||||||
|
ca-certificates \
|
||||||
|
blackbox xvfb xdotool \
|
||||||
|
pulseaudio pulseaudio-utils \
|
||||||
|
vlc-nox '^libvlc[0-9]+$' vlc-plugin-pulse
|
||||||
|
|
||||||
# Add "app" user
|
# Add "app" user
|
||||||
RUN mkdir -p /tmp/empty &&\
|
RUN mkdir -p /tmp/empty &&\
|
||||||
|
@ -8,13 +16,12 @@ RUN mkdir -p /tmp/empty &&\
|
||||||
useradd -d /home/app -l -N -g app -m -k /tmp/empty -u 9999 app &&\
|
useradd -d /home/app -l -N -g app -m -k /tmp/empty -u 9999 app &&\
|
||||||
rmdir /tmp/empty
|
rmdir /tmp/empty
|
||||||
|
|
||||||
ADD setup.sh /
|
ARG TS3CLIENT_VERSION=3.0.19.4
|
||||||
COPY src/ /home/app/src/
|
|
||||||
RUN sed -i 's,\r,,g' /setup.sh &&\
|
|
||||||
sh /setup.sh
|
|
||||||
|
|
||||||
# Copy over configuration for other daemons
|
COPY . /home/app/ts3bot/
|
||||||
COPY etc/ /etc
|
RUN cd ~app/ts3bot &&\
|
||||||
|
sed -i 's,\r,,g' setup.sh &&\
|
||||||
|
sh setup.sh
|
||||||
|
|
||||||
# Startup configuration
|
# Startup configuration
|
||||||
WORKDIR /home/app
|
WORKDIR /home/app
|
||||||
|
|
39
setup.sh
39
setup.sh
|
@ -7,13 +7,16 @@ export INITRD=no
|
||||||
export DEBIAN_FRONTEND=noninteractive
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
# Now install all packages we need
|
# Now install all packages we need
|
||||||
apt-get update
|
|
||||||
apt-get install -y --no-install-recommends \
|
apt-get install -y --no-install-recommends \
|
||||||
ca-certificates \
|
ca-certificates \
|
||||||
blackbox xvfb xdotool \
|
blackbox xvfb xdotool \
|
||||||
pulseaudio pulseaudio-utils \
|
pulseaudio pulseaudio-utils \
|
||||||
cmake python-minimal \
|
cmake python-minimal \
|
||||||
vlc-nox '^libvlc[0-9]+$' libvlc-dev vlc-plugin-pulse
|
vlc-nox '^libvlc[0-9]+$' libvlc-dev vlc-plugin-pulse
|
||||||
|
apt-mark auto \
|
||||||
|
cmake \
|
||||||
|
python-minimal \
|
||||||
|
libvlc-dev
|
||||||
|
|
||||||
# Configure GUI user, we are going to use the pre-setup "app" user for this
|
# Configure GUI user, we are going to use the pre-setup "app" user for this
|
||||||
mkdir -p /config
|
mkdir -p /config
|
||||||
|
@ -22,24 +25,26 @@ ln -sf /config ~app/.ts3bot
|
||||||
# Install TeamSpeak3.
|
# Install TeamSpeak3.
|
||||||
# Original comment that used to be here: temporary non-interactive teamspeak3 install hack, remove before publishing!!
|
# 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.
|
# 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
|
(
|
||||||
wget "http://teamspeak.gameserver.gamed.de/ts3/releases/${TS3CLIENT_VERSION}/TeamSpeak3-Client-linux_amd64-${TS3CLIENT_VERSION}.run" -Ots3client.run
|
cd ~app
|
||||||
chmod +x ./ts3client.run
|
wget "http://teamspeak.gameserver.gamed.de/ts3/releases/${TS3CLIENT_VERSION}/TeamSpeak3-Client-linux_amd64-${TS3CLIENT_VERSION}.run" -Ots3client.run
|
||||||
sed -i 's/^MS_PrintLicense$/#MS_PrintLicense/g' ./ts3client.run
|
chmod +x ./ts3client.run
|
||||||
./ts3client.run --quiet --target ts3client
|
sed -i 's/^MS_PrintLicense$/#MS_PrintLicense/g' ./ts3client.run
|
||||||
rm ./ts3client.run
|
./ts3client.run --quiet --target ts3client
|
||||||
|
rm ./ts3client.run
|
||||||
|
)
|
||||||
|
|
||||||
# Install TS3Bot via Git
|
# Install TS3Bot
|
||||||
npm_config_wcjs_runtime="node" npm_config_wcjs_runtime_version="$(node --version | tr -d 'v')" \
|
(
|
||||||
npm link --unsafe-perm ~app/src
|
cd ~app/ts3bot
|
||||||
|
npm_config_wcjs_runtime="node" npm_config_wcjs_runtime_version="$(node --version | tr -d 'v')" \
|
||||||
# Replace the shipped youtube-dl with the latest version (this is a hack that will hopefully be fixed soon!)
|
yarn global add --prod --check-files --verbose file:$(pwd)
|
||||||
wget -O/usr/local/bin/youtube-dl "https://yt-dl.org/downloads/latest/youtube-dl"
|
)
|
||||||
rm -f "$(dirname "$(readlink -f "$(which ts3bot)")")/node_modules/youtube-dl/bin/youtube-dl"
|
|
||||||
ln -sf "/usr/local/bin/youtube-dl" "$(dirname "$(readlink -f "$(which ts3bot)")")/node_modules/youtube-dl/bin/youtube-dl"
|
|
||||||
chmod a+rx "/usr/local/bin/youtube-dl"
|
|
||||||
|
|
||||||
# Clean up APT
|
# Clean up APT
|
||||||
apt-get autoremove -y --purge wget cmake cmake-data
|
apt-get autoremove -y --purge
|
||||||
apt-get clean
|
apt-get clean
|
||||||
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||||
|
|
||||||
|
# Copy over configuration for daemons
|
||||||
|
cp -a etc/* /etc/
|
||||||
|
|
Loading…
Reference in New Issue