improve Dockerfile for composer.json+composer.lock

This commit is contained in:
Christian Winther 2024-01-26 20:15:33 +00:00
parent 8d61b8d250
commit d2ed117d3f

View file

@ -186,12 +186,11 @@ COPY --link --from=composer-image /usr/bin/composer /usr/bin/composer
#! Changing user to runtime user
USER ${RUNTIME_UID}:${RUNTIME_GID}
# Copy over only composer related files so docker layer cache isn't invalidated on PHP file changes
COPY --chown=${RUNTIME_UID}:${RUNTIME_GID} composer.json composer.lock /var/www/
# Install composer dependencies
# NOTE: we skip the autoloader generation here since we don't have all files avaliable (yet)
RUN --mount=type=cache,id=pixelfed-composer-${PHP_VERSION}-${PHP_DEBIAN_RELEASE}-${TARGETPLATFORM},sharing=locked,target=/cache/composer \
--mount=type=bind,source=composer.json,target=/var/www/composer.json \
--mount=type=bind,source=composer.lock,target=/var/www/composer.lock \
set -ex \
&& composer install --prefer-dist --no-autoloader --ignore-platform-reqs