Skip to content

Commit

Permalink
Use explicit override (#2625)
Browse files Browse the repository at this point in the history
  • Loading branch information
sobolevn authored Aug 2, 2024
1 parent 221866b commit 42c79be
Show file tree
Hide file tree
Showing 6 changed files with 185 additions and 216 deletions.
11 changes: 7 additions & 4 deletions {{cookiecutter.project_name}}/docker/django/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ ENV DJANGO_ENV=${DJANGO_ENV} \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
PIP_DEFAULT_TIMEOUT=100 \
PIP_ROOT_USER_ACTION=ignore \
PIP_CONSTRAINT='/var/cache/pip_constraint.txt' \
# tini:
TINI_VERSION=v0.19.0 \
# poetry:
Expand All @@ -34,6 +35,9 @@ ENV DJANGO_ENV=${DJANGO_ENV} \

SHELL ["/bin/bash", "-eo", "pipefail", "-c"]

# Copy constrains for pip:
COPY docker/django/pip_constraint.txt /var/cache/pip_constraint.txt

# System deps (we don't use exact versions because it is hard to update them,
# pin when needed):
# hadolint ignore=DL3008
Expand Down Expand Up @@ -71,16 +75,15 @@ RUN groupadd -g "${GID}" -r web \
&& mkdir -p '/var/www/django/static' '/var/www/django/media' \
&& chown web:web '/var/www/django/static' '/var/www/django/media'

# Copy only requirements, to cache them in docker layer
# Copy only requirements, to cache them in docker layer:
COPY --chown=web:web ./poetry.lock ./pyproject.toml /code/

# Project initialization:
# hadolint ignore=SC2046
RUN --mount=type=cache,target="$POETRY_CACHE_DIR" \
echo "$DJANGO_ENV" \
&& poetry version \
# Install deps:
&& poetry run pip install -U pip \
&& poetry run pip install --constraint="$PIP_CONSTRAINT" pip \
&& poetry --version && poetry run pip --version \
&& poetry install \
$(if [ "$DJANGO_ENV" = 'production' ]; then echo '--only main'; fi) \
--no-interaction --no-ansi --sync
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pip==24.2
Loading

0 comments on commit 42c79be

Please sign in to comment.