From 83fff0942ef81e3bf58fcdfe9ed22f0908ef317a Mon Sep 17 00:00:00 2001 From: ZhymabekRoman Date: Wed, 25 Sep 2024 14:34:38 +0500 Subject: [PATCH] docker: cache packages in order to optimize building (at least i tried, nut it's doesn't looks like it's event works....) --- Dockerfile | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8030d34..01744df 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,28 +1,32 @@ FROM python:3.12.3 -# -slim ENV DEBIAN_FRONTEND=noninteractive -RUN pip install poetry && poetry config virtualenvs.create false +ENV POETRY_NO_INTERACTION=1 \ + POETRY_CACHE_DIR=/tmp/poetry_cache +# POETRY_VIRTUALENVS_IN_PROJECT=1 \ +# POETRY_VIRTUALENVS_CREATE=true \ + +RUN --mount=type=cache,target=~/.cache/pip pip install poetry && poetry config virtualenvs.create false WORKDIR /app -RUN pip install --no-cache-dir wheel Cython +RUN --mount=type=cache,target=~/.cache/pip pip install wheel Cython COPY ./rl_string_helper ./rl_string_helper -RUN pip3 install --no-cache-dir ./rl_string_helper +RUN --mount=type=cache,target=~/.cache/pip pip3 install ./rl_string_helper COPY ./database-lib ./database-lib -RUN pip3 install --no-cache-dir ./database-lib +RUN --mount=type=cache,target=~/.cache/pip pip3 install ./database-lib COPY ./medium-parser ./medium-parser -RUN pip3 install --no-cache-dir ./medium-parser +RUN --mount=type=cache,target=~/.cache/pip pip3 install ./medium-parser COPY ./web ./web WORKDIR /app/web -RUN poetry install +RUN --mount=type=cache,target=/tmp/poetry_cache poetry install --without dev --only main --no-ansi # EXPOSE 7080