Spotter-VM/pandora/Dockerfile

96 lines
3.4 KiB
Docker
Raw Normal View History

2018-01-18 13:39:39 +01:00
FROM alpine:3.7
MAINTAINER Disassembler <disassembler@dasm.cz>
RUN \
# Install Python3 runtime
apk --no-cache add python3 \
&& ln -s /usr/bin/python3 /usr/bin/python
RUN \
# Install runtime XML dependencies
apk --no-cache add libxml2 libxslt
RUN \
# Install runtime dependencies
apk --no-cache add ffmpeg imagemagick imlib2 libogg libtheora libvpx mkvtoolnix nginx poppler-utils py3-geoip py3-lxml py3-numpy py3-pillow py3-psycopg2 s6 \
2018-01-18 13:39:39 +01:00
&& pip3 install pyinotify youtube-dl
RUN \
# Install build dependencies
apk --no-cache add --virtual .deps autoconf automake build-base flac-dev git imlib2-dev libogg-dev libtheora-dev libtool libvpx-dev libvorbis-dev python3-dev \
2018-01-18 13:39:39 +01:00
# Compile liboggz
&& wget https://ftp.osuosl.org/pub/xiph/releases/liboggz/liboggz-1.1.1.tar.gz -O /tmp/liboggz.tgz \
&& tar xf /tmp/liboggz.tgz -C /tmp \
&& cd /tmp/liboggz-1.1.1 \
&& ./configure \
&& make -j $(nproc) \
&& make install \
# Compile libfishsound
&& wget https://ftp.osuosl.org/pub/xiph/releases/libfishsound/libfishsound-1.0.0.tar.gz -O /tmp/libfishsound.tgz \
&& tar xf /tmp/libfishsound.tgz -C /tmp/ \
&& cd /tmp/libfishsound-1.0.0 \
&& ./configure \
&& make -j $(nproc) \
&& make install \
# Compile liboggplay
&& git clone --depth 1 git://git.xiph.org/liboggplay.git /tmp/liboggplay \
&& cd /tmp/liboggplay \
&& ./autogen.sh \
&& ./configure \
&& make -j $(nproc) \
&& make install \
# Compile Oxframe
&& git clone --depth 1 https://code.0x2620.org/0x2620/oxframe /tmp/oxframe \
&& cd /tmp/oxframe \
&& sed -i '/man\/oxframe/d' Makefile \
&& make \
&& make install \
# Clone Pandora git repositories
&& git clone --depth 1 https://git.0x2620.org/pandora.git /srv/pandora \
&& git clone --depth 1 https://git.0x2620.org/oxjs.git /srv/pandora/static/oxjs \
&& git clone --depth 1 https://git.0x2620.org/python-ox.git /srv/pandora/src/python-ox \
&& git clone --depth 1 https://git.0x2620.org/oxtimelines.git /srv/pandora/src/oxtimelines \
&& pip3 install -e /srv/pandora/src/python-ox \
&& pip3 install -e /srv/pandora/src/oxtimelines \
&& pip3 install -r /srv/pandora/requirements.txt \
# Compile pyc and static files
&& cd /srv/pandora/pandora \
&& ln -s config.pandora.jsonc config.jsonc \
&& ./manage.py update_static \
&& ./manage.py compile_pyc -p /srv/pandora/pandora \
&& ./manage.py collectstatic -l --noinput \
2018-01-18 13:45:29 +01:00
# Create OS user
2018-01-27 22:35:55 +01:00
&& addgroup -S -g 8002 pandora \
&& adduser -S -u 8002 -h /srv/pandora -s /bin/false -g pandora -G pandora pandora \
&& chown -R 8002:8002 /srv/pandora \
2018-01-18 13:39:39 +01:00
# Cleanup
&& apk --no-cache del .deps \
2018-01-18 13:39:39 +01:00
&& find /srv/pandora -name '.git*' -exec rm -rf {} + \
&& rm -rf /tmp/lib* /tmp/oxframe \
&& rm -rf /root/.cache /root/.ox
2018-01-18 13:39:39 +01:00
2018-01-27 22:35:55 +01:00
COPY --chown=8002:8002 docker/srv/ /srv/
2018-01-18 13:39:39 +01:00
RUN \
# Update static files for Czech translation
cd /srv/pandora/pandora \
&& ./manage.py update_static \
# Hackfix missing virtualenv
&& mkdir /srv/pandora/bin \
&& ln -s /usr/bin/oxtimelines /srv/pandora/bin/oxtimelines \
# Create mount with dummy conf files
&& mkdir /srv/pandora/conf \
&& rm config.jsonc \
&& ln -s /srv/pandora/conf/config.jsonc config.jsonc \
&& ln -s /srv/pandora/conf/gunicorn_config.py gunicorn_config.py \
&& ln -s /srv/pandora/conf/local_settings.py local_settings.py \
2018-01-27 22:35:55 +01:00
&& chown -R 8002:8002 /srv/pandora
2018-01-18 13:39:39 +01:00
COPY docker/etc/ /etc/
VOLUME ["/srv/pandora/conf", "/srv/pandora/data"]
EXPOSE 8080
2018-01-18 13:39:39 +01:00
WORKDIR /srv/pandora
CMD ["s6-svscan", "/etc/services.d"]