Skip to content

Commit

Permalink
fix: Dockerfile
Browse files Browse the repository at this point in the history
Use “RUN --mount=type=cache“ to cache apt

Signed-off-by: 冯诚 <[email protected]>
  • Loading branch information
findlayfeng committed Jul 3, 2024
1 parent 6ca1b7a commit 4ef8045
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packaging/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@ ARG RUNTIME_DEPS=" \
locales \
locales-all \
"
RUN set -ex; \
RUN --mount=type=cache,target=/var/lib/apt/lists \
set -ex; \
\
apt-get update; \
apt-get install -y --no-install-recommends ${RUNTIME_DEPS}; \
rm -rf /var/lib/apt/lists/*
:;

ARG LC_CTYPE=en_US.UTF-8
ENV LC_CTYPE=${LC_CTYPE}
Expand All @@ -52,7 +53,8 @@ ARG BUILD_DEPS=" \
libwebp-dev \
libldap2-dev \
"
RUN set -ex; \
RUN --mount=type=cache,target=/var/lib/apt/lists \
set -ex; \
\
savedAptMark="$(apt-mark showmanual)"; \
\
Expand All @@ -79,7 +81,6 @@ RUN set -ex; \
| xargs -rt apt-mark manual; \
\
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
rm -rf /var/lib/apt/lists/*; \
ln -s "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"; \
:;

Expand Down

0 comments on commit 4ef8045

Please sign in to comment.