2017-12-26 09:33:47 +01:00
|
|
|
FROM alpine:3.7
|
|
|
|
MAINTAINER Disassembler <disassembler@dasm.cz>
|
|
|
|
|
|
|
|
RUN \
|
|
|
|
# Install Python2 runtime
|
|
|
|
apk --no-cache add python2
|
|
|
|
|
|
|
|
RUN \
|
|
|
|
# Install runtime dependencies
|
2018-01-08 21:04:35 +01:00
|
|
|
apk --no-cache add libpq zlib
|
|
|
|
|
|
|
|
RUN \
|
2017-12-26 09:33:47 +01:00
|
|
|
# Install build dependencies
|
2018-01-08 21:04:35 +01:00
|
|
|
apk --no-cache add --virtual .deps git build-base postgresql-dev python2-dev py2-pip zlib-dev \
|
2017-12-26 09:33:47 +01:00
|
|
|
# Add edge/testing repository for postgis (geos) support
|
2017-12-28 09:45:21 +01:00
|
|
|
&& echo 'http://dl-cdn.alpinelinux.org/alpine/edge/testing' >>/etc/apk/repositories \
|
2017-12-26 09:33:47 +01:00
|
|
|
&& apk --no-cache add geos \
|
|
|
|
# Install CTS
|
|
|
|
&& git clone --depth 1 https://github.com/theirc/CTS /srv/cts \
|
|
|
|
# Force psycopg2 version update for compatibility with PostgreSQL 10
|
|
|
|
&& sed -i 's/psycopg2==2.5.2/psycopg2==2.7.1/' /srv/cts/requirements/base.txt \
|
|
|
|
&& 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 \
|
|
|
|
# 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 del .deps \
|
|
|
|
&& find /srv/cts -name '.git*' -exec rm -rf {} + \
|
|
|
|
&& rm -rf /root \
|
|
|
|
&& mkdir /root
|
|
|
|
|
|
|
|
VOLUME ["/srv/cts/cts/settings"]
|
|
|
|
EXPOSE 8006
|
|
|
|
|
|
|
|
USER cts
|
|
|
|
ENV DJANGO_SETTINGS_MODULE cts.settings.spotter
|
|
|
|
WORKDIR /srv/cts
|
|
|
|
CMD ["manage.py", "runserver", "0.0.0.0:8006"]
|