LXCize CTS build

This commit is contained in:
Disassembler 2018-09-13 10:38:58 +02:00
parent 6583acc129
commit 88008ad40b
No known key found for this signature in database
GPG Key ID: 524BD33A0EE29499
11 changed files with 49 additions and 40 deletions

View File

@ -1,40 +0,0 @@
FROM python2
LABEL maintainer="Disassembler <disassembler@dasm.cz>"
RUN \
# Add edge/testing repository
echo '@edge http://dl-cdn.alpinelinux.org/alpine/edge/testing' >>/etc/apk/repositories \
# Install runtime dependencies
&& apk --no-cache add geos@edge libpq nginx zlib
RUN \
# Install build dependencies
apk --no-cache add --virtual .deps build-base git postgresql-dev python2-dev py2-pip zlib-dev \
# 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 \
# 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 \
# 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 \
&& find /srv/cts -name '.git*' -exec rm -rf {} + \
&& rm -rf /root/.cache
COPY docker/ /
VOLUME ["/srv/cts/cts/settings"]
EXPOSE 8080
ENV DJANGO_SETTINGS_MODULE cts.settings.spotter
WORKDIR /srv/cts
CMD ["s6-svscan", "/etc/services.d"]

49
cts/lxcfile Normal file
View File

@ -0,0 +1,49 @@
IMAGE cts
LAYER shared/alpine
LAYER shared/libxml
LAYER shared/python2
LAYER cts/cts
RUN EOF
# Add edge/testing repository
echo '@edge http://dl-cdn.alpinelinux.org/alpine/edge/testing' >>/etc/apk/repositories
# Install runtime dependencies
apk --no-cache add geos@edge libpq nginx zlib
# Install build dependencies
apk --no-cache add --virtual .deps build-base git postgresql-dev python2-dev py2-pip zlib-dev
# 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
# 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
# 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
find /srv/cts -name '.git*' -exec rm -rf {} +
rm -rf /root/.cache
EOF
COPY lxc
MOUNT /srv/cts/conf srv/cts/cts/settings
ENV DJANGO_SETTINGS_MODULE cts.settings.spotter
WORKDIR /srv/cts
CMD /bin/s6-svscan /etc/services.d