Skip to content

Commit

Permalink
Fix pip update
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Aug 12, 2024
1 parent 91407bc commit 94955cc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
17 changes: 9 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Base of all section, install the apt packages
FROM ubuntu:24.04 as base-all
FROM ubuntu:24.04 AS base-all
LABEL maintainer Camptocamp "[email protected]"

# Fail on error on pipe, see: https://github.com/hadolint/hadolint/wiki/DL4006.
Expand All @@ -11,13 +11,14 @@ RUN --mount=type=cache,target=/var/lib/apt/lists \
--mount=type=cache,target=/var/cache,sharing=locked \
apt-get update \
&& apt-get upgrade --assume-yes \
&& apt-get install --assume-yes --no-install-recommends python3-pip postgresql-client docker.io libmagic1 git curl gnupg zlib1g libpq5
&& apt-get install --assume-yes --no-install-recommends python3-pip python3-venv postgresql-client docker.io libmagic1 git curl gnupg zlib1g libpq5 \
&& python3 -m venv /venv

RUN rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED
ENV PATH=/venv/bin:$PATH

# Used to convert the locked packages by poetry to pip requirements format
# We don't directly use `poetry install` because it force to use a virtual environment.
FROM base-all as poetry
FROM base-all AS poetry

# Fail on error on pipe, see: https://github.com/hadolint/hadolint/wiki/DL4006.
# Treat unset variables as an error when substituting.
Expand All @@ -37,7 +38,7 @@ RUN poetry export --output=requirements.txt \
&& poetry export --with=dev --output=requirements-dev.txt

# Base, the biggest thing is to install the Python packages
FROM base-all as base
FROM base-all AS base

# Fail on error on pipe, see: https://github.com/hadolint/hadolint/wiki/DL4006.
# Treat unset variables as an error when substituting.
Expand Down Expand Up @@ -102,7 +103,7 @@ EXPOSE 8080
WORKDIR /app/

# The final part
FROM base as runner
FROM base AS runner

ENV PATH=/pyenv/shims:/pyenv/bin:/var/www/.local/bin/:${PATH} \
PYENV_ROOT=/pyenv
Expand Down Expand Up @@ -146,7 +147,7 @@ RUN mkdir -p /prometheus-metrics \
ENV PROMETHEUS_MULTIPROC_DIR=/prometheus-metrics

# Do the lint, used by the tests
FROM base as tests
FROM base AS tests

# Fail on error on pipe, see: https://github.com/hadolint/hadolint/wiki/DL4006.
# Treat unset variables as an error when substituting.
Expand All @@ -164,7 +165,7 @@ RUN --mount=type=cache,target=/root/.cache \
python3 -m pip install --disable-pip-version-check --no-deps --requirement=/poetry/requirements-dev.txt

# hadolint ignore=DL3003
RUN cd /usr/local/lib/python3.12/dist-packages/c2cwsgiutils/acceptance/ && npm install
RUN find / -name c2cwsgiutils; cd /venv/lib/python3.12/site-packages/c2cwsgiutils/acceptance/ && npm install

COPY . ./
RUN --mount=type=cache,target=/root/.cache \
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ types-requests = "2.32.0.20240712"
types-toml = "0.10.8.20240310"

[build-system]
requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning", "poetry-plugin-tweak-dependencies-version", "poetry-plugin-drop-python-upper-constraint"]
requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning==1.4.0", "poetry-plugin-tweak-dependencies-version==1.5.2", "poetry-plugin-drop-python-upper-constraint==0.1.0", "poetry-plugin-export==1.8.0"]
build-backend = "poetry.core.masonry.api"

[tool.poetry-dynamic-versioning]
Expand Down
5 changes: 0 additions & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
poetry==1.8.3
poetry-plugin-export==1.8.0
poetry-dynamic-versioning==1.4.0
poetry-plugin-tweak-dependencies-version==1.5.2
pip==24.2
poetry-plugin-drop-python-upper-constraint==0.1.0
certifi>=2024.7.4 # not directly required, pinned by Snyk to avoid a vulnerability
jinja2>=3.1.3 # not directly required, pinned by Snyk to avoid a vulnerability
cryptography>=42.0.8 # not directly required, pinned by Snyk to avoid a vulnerability
Expand Down

0 comments on commit 94955cc

Please sign in to comment.