diff --git a/.dockerignore b/.dockerignore index 6b8710a7..a715c9d7 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1 +1,2 @@ .git +.env diff --git a/Dockerfile b/Dockerfile index 50b81cbb..4c1a9a66 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,5 @@ -FROM python:3.10.0-alpine3.15 +# FROM python:3.10.0-alpine3.15 +FROM python:3.5-alpine3.12 WORKDIR /usr/src/app @@ -7,12 +8,25 @@ RUN apk add --update --no-cache \ build-base \ openldap-dev \ python3-dev \ - libpq-dev \ + postgresql-dev \ + jpeg-dev \ + libxml2-dev \ + libxslt-dev \ + libmemcached-dev \ + zlib-dev \ && rm -rf /var/cache/apk/* +## For alpine 3.15 replace postgresql-dev with libpq-dev + # FIX https://github.com/python-ldap/python-ldap/issues/432 RUN echo 'INPUT ( libldap.so )' > /usr/lib/libldap_r.so COPY requirements.txt ./ -RUN pip install --no-cache-dir -r requirements.txt + +# Pillow seems to need LIBRARY_PATH set as follows: (see: https://github.com/python-pillow/Pillow/issues/1763#issuecomment-222383534) +RUN LIBRARY_PATH=/lib:/usr/lib /bin/sh -c "pip install --no-cache-dir -r requirements.txt" + COPY ./ . +COPY entrypoint.sh / + +ENTRYPOINT ["/entrypoint.sh" ] diff --git a/build-image.sh b/build-image.sh new file mode 100755 index 00000000..64a67fd6 --- /dev/null +++ b/build-image.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +if [ $# -lt 1 ]; then + echo "$0 imageversion [push]" + echo "Version could be: $(git describe --always)" + echo "If push is specified, also push to our harbor" + exit 1 +fi + +tagprefix=harbor.k8s.ungleich.ch/ungleich-public/dynamicweb +version=$1; shift + +tag=${tagprefix}:${version} + +set -ex + +docker build -t "${tag}" . + +push=$1; shift + +if [ "$push" ]; then + docker push "${tag}" +fi diff --git a/dynamicweb/settings/base.py b/dynamicweb/settings/base.py index f03042dc..b7705e17 100644 --- a/dynamicweb/settings/base.py +++ b/dynamicweb/settings/base.py @@ -777,3 +777,9 @@ if DEBUG: from .local import * # flake8: noqa else: from .prod import * # flake8: noqa + +# Try to load dynamic configuration, if it exists +try: + from .dynamic import * # flake8: noqa +except ImportError: + pass diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 00000000..e207a457 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +set -uex + +cd /usr/src/app/ +cat > dynamicweb/settings/dynamic.py <