docker: cache packages in order to optimize building

(at least i tried, nut it's doesn't looks like it's event works....)
This commit is contained in:
ZhymabekRoman 2024-09-25 14:34:38 +05:00
parent a6f44e4659
commit 83fff0942e

View file

@ -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