From cf77c5c1ba47183dada33e12947db86ffd5228dd Mon Sep 17 00:00:00 2001 From: Dominik George <dominik.george@teckids.org> Date: Thu, 30 Jan 2020 15:21:02 +0100 Subject: [PATCH] [Docker] Fix build after SchoolApps merge and use poetry again --- Dockerfile | 34 ++++++++++++++++++++++------------ docker/entrypoint.sh | 2 -- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/Dockerfile b/Dockerfile index 79b6e3c81..33babc3fc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,25 +25,35 @@ RUN apt-get -y update && \ netcat-openbsd \ yarnpkg -# Install core dependnecies +# Install core WORKDIR /usr/src/app -COPY poetry.lock pyproject.toml ./ -RUN eatmydata pip install poetry; \ - poetry export -f requirements.txt | eatmydata pip install -r /dev/stdin; \ +COPY LICENCE.rst README.rst manage.py poetry.lock pyproject.toml ./ +COPY aleksis ./aleksis/ +RUN set -e; \ + mkdir -p /var/lib/aleksis/media /var/lib/aleksis/static /var/lib/aleksis/backups; \ + eatmydata pip install poetry; \ + poetry config virtualenvs.create false; \ + eatmydata poetry install; \ eatmydata pip install gunicorn -# Install core -COPY aleksis ./aleksis/ -COPY LICENCE.rst README.rst manage.py ./ -RUN mkdir -p /var/lib/aleksis/media /var/lib/aleksis/static /var/lib/aleksis/backups; \ - poetry build && eatmydata pip install dist/*.whl +# Install official apps +COPY apps ./apps/ +RUN set -e; \ + for d in apps/official/*; do \ + cd $d; \ + rm -rf .git; \ + poetry install; \ + cd ../../..; \ + done # Build messages and assets -RUN python manage.py compilemessages; \ - eatmydata python manage.py yarn install +RUN eatmydata python manage.py compilemessages && \ + eatmydata python manage.py yarn install && \ + eatmydata python manage.py collectstatic --no-input --clear # Clean up build dependencies -RUN eatmydata apt-get remove --purge -y \ +RUN set -e; \ + eatmydata apt-get remove --purge -y \ build-essential \ gettext \ libpq-dev \ diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index cd3300075..bb5eca2a1 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -17,9 +17,7 @@ while ! nc -z $ALEKSIS_database__host $ALEKSIS_database__port; do sleep 0.1 done -python manage.py flush --no-input python manage.py migrate -python manage.py collectstatic --no-input --clear if [[ -n "$@" ]]; then exec "$@" -- GitLab