diff options
author | 2022-09-17 23:22:20 +0400 | |
---|---|---|
committer | 2022-09-18 00:03:21 +0400 | |
commit | b8f64167aeb93156eb6e066415116a3ce01ac0f9 (patch) | |
tree | 91b0992058e931cd55549bf61351691d60162d10 /Dockerfile | |
parent | Fix grammar in contributing guide (#771) (diff) |
Fix Poetry 1.2 Support
Poetry 1.2 introduced a regression which broke pip `--user` installs.
These types of install where the main way we did installations in docker
and CI, which made it much more convenient to control their location,
availability, and caching.
Poetry's team does not recognize this as a supported use case, so major
changes were required to get everything working again. Most of the
changes were consolidated into chrislovering/python-poetry-base for
docker, and hassanabouelela/setup-python for CI.
Signed-off-by: Hassan Abouelela <[email protected]>
Diffstat (limited to 'Dockerfile')
-rw-r--r-- | Dockerfile | 17 |
1 files changed, 5 insertions, 12 deletions
@@ -1,21 +1,14 @@ -FROM --platform=linux/amd64 python:3.9-slim-buster +FROM ghcr.io/chrislovering/python-poetry-base:3.9-slim # Allow service to handle stops gracefully STOPSIGNAL SIGQUIT -# Set pip to have cleaner logs and no saved cache -ENV PIP_NO_CACHE_DIR=false \ - POETRY_VIRTUALENVS_CREATE=false - -# Install poetry -RUN pip install -U poetry - # Copy the project files into working directory WORKDIR /app # Install project dependencies COPY pyproject.toml poetry.lock ./ -RUN poetry install --no-dev +RUN poetry install --without dev # Set Git SHA environment variable ARG git_sha="development" @@ -34,14 +27,14 @@ RUN \ SECRET_KEY=dummy_value \ DATABASE_URL=postgres://localhost \ METRICITY_DB_URL=postgres://localhost \ - python manage.py collectstatic --noinput --clear + poetry run python manage.py collectstatic --noinput --clear # Build static files if we are doing a static build ARG STATIC_BUILD=false RUN if [ $STATIC_BUILD = "TRUE" ] ; \ - then SECRET_KEY=dummy_value python manage.py distill-local build --traceback --force ; \ + then SECRET_KEY=dummy_value poetry run python manage.py distill-local build --traceback --force ; \ fi # Run web server through custom manager -ENTRYPOINT ["python", "manage.py"] +ENTRYPOINT ["poetry", "run", "python", "manage.py"] CMD ["run"] |