1
0

image: improve Python cache copying

This commit is contained in:
Konstantin Demin 2024-10-10 00:23:55 +03:00
parent 9ff0ff517d
commit c38c488642
Signed by: krd
GPG Key ID: 4D56F87A8BA65FD0

View File

@ -64,6 +64,12 @@ RUN d="@$(date '+%s')" ; \
find /usr/local/lib/ -name '*.pyc' -exec touch -m -d "$d" {} + ; \
find /usr/local/lib/ -name __pycache__ -exec touch -m -d "$d" {} +
WORKDIR /pycache
RUN find /usr/local/ -type f -name '*.py[co]' -printf '%P\0' \
| sort -zV \
| tar -C /usr/local --null -T - -cf - \
| tar -xf -
## ---
FROM deps
@ -76,12 +82,10 @@ COPY /Dockerfile /usr/local/share/
COPY --from=setup /etc/apt/keyrings/angie.gpg.asc /etc/apt/keyrings/
COPY --from=setup /etc/apt/sources.list.d/angie.sources /etc/apt/sources.list.d/
## RFC: Python cache
## TODO: reduce load by selecting only __pycache__ directories in either way
COPY --from=pycache /usr/local/lib/ /usr/local/lib/
COPY /j2cfg/ /usr/local/lib/j2cfg/
## already copied by statement above
# COPY /j2cfg/ /usr/local/lib/j2cfg/
## RFC: Python cache
COPY --from=pycache /pycache/ /usr/local/
ENV ANGIE_MODULES_DIR=/usr/lib/angie/modules