2
0
mirror of https://github.com/frappe/frappe_docker.git synced 2025-01-10 09:02:13 +00:00

Cache pip deps on build

This commit is contained in:
Lev Vereshchagin 2022-02-25 13:11:20 +03:00
parent 29d4a46897
commit e5360be50e

View File

@ -14,9 +14,10 @@ USER frappe
RUN mkdir -p /home/frappe/frappe-bench/apps /home/frappe/frappe-bench/logs /home/frappe/frappe-bench/sites RUN mkdir -p /home/frappe/frappe-bench/apps /home/frappe/frappe-bench/logs /home/frappe/frappe-bench/sites
WORKDIR /home/frappe/frappe-bench WORKDIR /home/frappe/frappe-bench
RUN pip install --no-cache-dir -U pip wheel \ RUN --mount=type=cache,target=/home/frappe/.cache/pip \
pip install -U pip wheel \
&& python -m venv env \ && python -m venv env \
&& env/bin/pip install --no-cache-dir -U pip wheel && env/bin/pip install -U pip wheel
USER root USER root
@ -43,9 +44,10 @@ USER frappe
FROM build_deps as frappe_builder FROM build_deps as frappe_builder
ARG FRAPPE_VERSION ARG FRAPPE_VERSION
RUN git clone --depth 1 -b ${FRAPPE_VERSION} https://github.com/frappe/frappe apps/frappe \ RUN --mount=type=cache,target=/home/frappe/.cache/pip \
&& env/bin/pip install --no-cache-dir -e apps/frappe \ git clone --depth 1 -b ${FRAPPE_VERSION} https://github.com/frappe/frappe apps/frappe \
&& env/bin/pip install --no-cache-dir -U gevent \ && env/bin/pip install -e apps/frappe \
&& env/bin/pip install -U gevent \
&& rm -r apps/frappe/.git && rm -r apps/frappe/.git
@ -57,7 +59,8 @@ ARG ERPNEXT_VERSION
RUN git clone --depth 1 -b ${ERPNEXT_VERSION} https://github.com/frappe/erpnext apps/erpnext \ RUN git clone --depth 1 -b ${ERPNEXT_VERSION} https://github.com/frappe/erpnext apps/erpnext \
&& rm -r apps/erpnext/.git && rm -r apps/erpnext/.git
RUN pip wheel --wheel-dir /home/frappe/erpnext-wheels -r apps/erpnext/requirements.txt RUN --mount=type=cache,target=/home/frappe/.cache/pip \
pip wheel --wheel-dir /home/frappe/erpnext-wheels -r apps/erpnext/requirements.txt
@ -65,8 +68,9 @@ FROM frappe_builder as erpnext_builder
COPY --from=erpnext_wheels --chown=frappe /home/frappe/frappe-bench/apps/erpnext /home/frappe/frappe-bench/apps/erpnext COPY --from=erpnext_wheels --chown=frappe /home/frappe/frappe-bench/apps/erpnext /home/frappe/frappe-bench/apps/erpnext
RUN --mount=type=bind,target=/home/frappe/erpnext-wheels,source=/home/frappe/erpnext-wheels,from=erpnext_wheels \ RUN --mount=type=bind,target=/home/frappe/erpnext-wheels,source=/home/frappe/erpnext-wheels,from=erpnext_wheels \
--mount=type=cache,target=/home/frappe/.cache/pip \
--mount=type=cache,target=/home/frappe/.cache/pip,source=/home/frappe/.cache/pip,from=erpnext_wheels \ --mount=type=cache,target=/home/frappe/.cache/pip,source=/home/frappe/.cache/pip,from=erpnext_wheels \
env/bin/pip install --find-links=/home/frappe/erpnext-wheels --no-cache-dir -e apps/erpnext env/bin/pip install --find-links=/home/frappe/erpnext-wheels -e apps/erpnext