Spotter-VM/cts/Dockerfile

41 lines
1.4 KiB
Docker
Raw Normal View History

2018-04-30 22:57:50 +02:00
FROM python2
LABEL maintainer="Disassembler <disassembler@dasm.cz>"
2017-12-26 09:33:47 +01:00
RUN \
2018-01-27 22:46:45 +01:00
# Add edge/testing repository
echo '@edge http://dl-cdn.alpinelinux.org/alpine/edge/testing' >>/etc/apk/repositories \
2017-12-26 09:33:47 +01:00
# Install runtime dependencies
2018-04-30 22:57:50 +02:00
&& apk --no-cache add geos@edge libpq nginx zlib
2018-01-08 21:04:35 +01:00
RUN \
2017-12-26 09:33:47 +01:00
# Install build dependencies
2018-01-27 15:23:22 +01:00
apk --no-cache add --virtual .deps build-base git postgresql-dev python2-dev py2-pip zlib-dev \
2017-12-26 09:33:47 +01:00
# Install CTS
&& git clone --depth 1 https://github.com/theirc/CTS /srv/cts \
&& pip install -r /srv/cts/requirements/production.txt \
# Hackfix geos version detection
&& sed -i 's/\$//' /usr/lib/python2.7/site-packages/django/contrib/gis/geos/libgeos.py \
# Make manage.py globally executable
&& chmod +x /srv/cts/manage.py \
&& ln -s /srv/cts/manage.py /usr/local/bin/manage.py \
2018-01-18 20:50:01 +01:00
# Compile static files
&& sed -i '/debug_toolbar/d' /srv/cts/cts/settings/dev.py \
&& DJANGO_SETTINGS_MODULE=cts.settings.dev manage.py collectstatic -l --noinput \
2017-12-26 09:33:47 +01:00
# Create OS user
&& addgroup -S -g 8006 cts \
&& adduser -S -u 8006 -h /srv/cts -s /bin/false -g cts -G cts cts \
&& chown -R cts:cts /srv/cts \
# Cleanup
&& apk --no-cache del .deps \
2017-12-26 09:33:47 +01:00
&& find /srv/cts -name '.git*' -exec rm -rf {} + \
2018-01-18 20:50:01 +01:00
&& rm -rf /root/.cache
2017-12-26 09:33:47 +01:00
2018-02-01 14:01:05 +01:00
COPY docker/ /
2017-12-26 09:33:47 +01:00
VOLUME ["/srv/cts/cts/settings"]
EXPOSE 8080
2017-12-26 09:33:47 +01:00
ENV DJANGO_SETTINGS_MODULE cts.settings.spotter
WORKDIR /srv/cts
2018-02-01 14:01:05 +01:00
CMD ["s6-svscan", "/etc/services.d"]