diff --git a/image/pip b/image/pip index ff099e5629358eba95060d3931fe30a05f57d1ba..9ce535682bcf68159e4c1c1c54ca43ce83f1a14e 100644 --- a/image/pip +++ b/image/pip @@ -9,10 +9,15 @@ RUN pip install "poetry>=1.8,<2.0" WORKDIR /silkaj -# Copy source tree +# Copy pyproject.toml and install dependencies +# So this dependencies installation layer +# does not change when the sources changes +# https://python-poetry.org/docs/faq/#poetry-busts-my-docker-cache-because-it-requires-me-to-copy-my-source-files-in-before-installing-3rd-party-dependencies +COPY pyproject.toml . +RUN poetry install --only main --no-root + +# Copy source tree, install and build Silkaj COPY ./ ./ - -# Install Silkaj RUN poetry install --only main --extras deathreaper RUN poetry build diff --git a/image/poetry b/image/poetry index 759e324da4de0221941f32277968404ffb723f5f..96eb0d39094bb8fc0e721e65698d8efafea800aa 100644 --- a/image/poetry +++ b/image/poetry @@ -6,6 +6,13 @@ FROM registry.duniter.org/docker/python3/poetry/${PYTHON_VERS}:latest AS build WORKDIR /silkaj +# Copy pyproject.toml and install dependencies +# So this dependencies installation layer +# does not change when the sources changes +# https://python-poetry.org/docs/faq/#poetry-busts-my-docker-cache-because-it-requires-me-to-copy-my-source-files-in-before-installing-3rd-party-dependencies +COPY pyproject.toml . +RUN poetry install --only main --no-root + # Copy source tree COPY ./ ./ @@ -16,7 +23,6 @@ RUN poetry install --only main --extras deathreaper # Final Stage # ------------------------------------------------------------------------------ FROM registry.duniter.org/docker/python3/poetry/${PYTHON_VERS}:latest -ARG PYTHON_VERS # Create silkaj group and user RUN groupadd -g 1111 silkaj && \