neko/Dockerfile

116 lines
4.1 KiB
Docker
Raw Normal View History

2020-01-28 20:07:35 +13:00
FROM debian:stretch-slim
2020-01-27 14:28:39 +13:00
2020-01-28 20:07:35 +13:00
# avoid warnings by switching to noninteractive
ENV DEBIAN_FRONTEND=noninteractive
ENV GSTPATH /gst
ENV GST_VERSION 1.16
2020-01-27 14:28:39 +13:00
# build gstreamer
2020-01-28 20:07:35 +13:00
RUN set -eux && \
apt-get update && apt-get install -y --no-install-recommends \
git ca-certificates build-essential perl python pkg-config autoconf automake autopoint libtool bison flex \
gettext nasm openssl libglib2.0-dev libopus-dev libvpx-dev libpulse-dev libx11-dev libxv-dev libxt-dev \
libxtst-dev libxfixes-dev libssl-dev \
## set up dir
&& mkdir $GSTPATH \
2020-01-27 14:28:39 +13:00
#
# build openh264
2020-01-28 20:07:35 +13:00
&& cd $GSTPATH \
2020-01-27 14:28:39 +13:00
&& git clone https://github.com/cisco/openh264.git \
&& cd openh264 \
&& make && make install \
2020-01-28 20:07:35 +13:00
&& cd $GSTPATH && rm -rf openh264 \
2020-01-27 14:28:39 +13:00
#
2020-01-28 20:07:35 +13:00
# build gstreamer
&& for MODULE in \
gstreamer \
gst-plugins-base \
gst-plugins-good \
gst-plugins-bad \
; do \
git clone git://anongit.freedesktop.org/gstreamer/$MODULE; \
cd $MODULE; \
git checkout $GST_VERSION; \
PATH=$GSTPATH/local/bin:$PATH PKG_CONFIG_PATH=$GSTPATH/local/lib/pkgconfig ./autogen.sh --prefix $GSTPATH/local --disable-gtk-doc; \
make && make install; \
cd $GSTPATH && rm -rf $MODULE; \
done \
2020-01-27 14:28:39 +13:00
#
# remove build deps
2020-01-28 20:07:35 +13:00
&& apt-get --purge autoremove -y build-essential perl python pkg-config autoconf automake autopoint libtool bison flex \
gettext nasm openssl libglib2.0-dev libopus-dev libvpx-dev libpulse-dev libx11-dev libxv-dev libxt-dev \
libxtst-dev libxfixes-dev libssl-dev
ENV PATH=$GSTPATH/local/bin:$PATH
ENV LD_LIBRARY_PATH=$GSTPATH/local/lib:$LD_LIBRARY_PATH
ENV PKG_CONFIG_PATH=$GSTPATH/local/lib/pkgconfig:$PKG_CONFIG_PATH
2020-01-13 21:05:38 +13:00
ARG USERNAME=neko
ARG USER_UID=1000
ARG USER_GID=$USER_UID
2020-01-27 14:28:39 +13:00
# install neko dependencies
2020-01-28 20:07:35 +13:00
RUN set -eux \
&& apt-get update && apt-get install -y --no-install-recommends wget ca-certificates pulseaudio openbox dbus-x11 xvfb libxv1 xclip firefox-esr supervisor \
2020-01-13 21:05:38 +13:00
#
2020-01-27 14:28:39 +13:00
# create a non-root user
2020-01-28 20:07:35 +13:00
&& groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USERNAME --shell /bin/bash --create-home $USERNAME \
2020-01-13 21:05:38 +13:00
&& adduser $USERNAME audio \
&& adduser $USERNAME video \
&& adduser $USERNAME pulse \
#
2020-01-28 20:07:35 +13:00
# install extensions
&& mkdir -p /usr/lib/firefox-esr/distribution/extensions \
&& wget -O /usr/lib/firefox-esr/distribution/extensions/uBlock0@raymondhill.net.xpi https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi \
&& wget -O /usr/lib/firefox-esr/distribution/extensions/nordvpnproxy@nordvpn.com.xpi https://addons.mozilla.org/firefox/downloads/latest/nordvpn-proxy-extension/latest.xpi \
2020-01-14 00:28:14 +13:00
#
2020-01-27 14:28:39 +13:00
# setup pulseaudio
2020-01-14 12:12:55 +13:00
&& mkdir -p /home/$USERNAME/.config/pulse/ \
2020-01-13 21:05:38 +13:00
&& echo "default-server=unix:/tmp/pulseaudio.socket" > /home/$USERNAME/.config/pulse/client.conf \
#
2020-01-27 14:28:39 +13:00
# workaround for an X11 problem: http://blog.tigerteufel.de/?p=476
2020-01-14 12:12:55 +13:00
&& mkdir /tmp/.X11-unix && chmod 1777 /tmp/.X11-unix && chown $USERNAME /tmp/.X11-unix/ \
#
2020-01-27 14:28:39 +13:00
# make directories for neko
2020-01-29 05:45:00 +13:00
&& mkdir -p /etc/neko /var/www /home/$USERNAME/.neko/logs \
&& chown -R $USERNAME:$USERNAME /home/$USERNAME \
2020-01-28 20:07:35 +13:00
#
# clean up
&& apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/*
2020-01-27 14:28:39 +13:00
#
# env
ENV USER=$USERNAME
ENV SCREEN_WIDTH=1280
ENV SCREEN_HEIGHT=720
ENV SCREEN_DEPTH=24
ENV DISPLAY=:99.0
2020-01-13 21:05:38 +13:00
#
2020-01-27 14:28:39 +13:00
# copy configuation files
COPY .docker/files/dbus /usr/bin/dbus
COPY .docker/files/openbox.xml /etc/neko/openbox.xml
COPY .docker/files/supervisord.conf /etc/neko/supervisord.conf
COPY .docker/files/default.pa /etc/pulse/default.pa
2020-01-28 20:07:35 +13:00
COPY .docker/files/firefox/neko.js /usr/lib/firefox-esr/mozilla.cfg
COPY .docker/files/firefox/autoconfig.js /usr/lib/firefox-esr/defaults/pref/autoconfig.js
COPY .docker/files/firefox/policies.json /usr/lib/firefox-esr/distribution/policies.json
2020-01-13 21:05:38 +13:00
#
2020-01-27 14:28:39 +13:00
# neko files
2020-01-13 21:05:38 +13:00
COPY client/dist/ /var/www
COPY server/bin/neko /usr/bin/neko
#
2020-01-27 14:28:39 +13:00
# neko env
2020-01-13 21:05:38 +13:00
ENV NEKO_PASSWORD=neko
2020-01-24 06:29:20 +13:00
ENV NEKO_ADMIN=admin
2020-01-14 12:12:55 +13:00
ENV NEKO_BIND=:8080
2020-01-13 21:05:38 +13:00
#
2020-01-27 14:28:39 +13:00
# run neko
CMD ["/usr/bin/supervisord", "-c", "/etc/neko/supervisord.conf"]