From 94955cc71223e9baef3b44f16249a1b1ff133118 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Brunner?= Date: Mon, 12 Aug 2024 11:30:54 +0200 Subject: [PATCH] Fix pip update --- Dockerfile | 17 +++++++++-------- pyproject.toml | 2 +- requirements.txt | 5 ----- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/Dockerfile b/Dockerfile index 08ae701b30b..0f0a616a43a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 "info@camptocamp.com" # Fail on error on pipe, see: https://github.com/hadolint/hadolint/wiki/DL4006. @@ -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. @@ -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. @@ -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 @@ -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. @@ -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 \ diff --git a/pyproject.toml b/pyproject.toml index 60b480a25e4..52333990027 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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] diff --git a/requirements.txt b/requirements.txt index 7beebd9d344..bede96431da 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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