Browse Source

improve Dockerfile for composer.json+composer.lock

Christian Winther 1 year ago
parent
commit
d2ed117d3f
1 changed files with 2 additions and 3 deletions
  1. 2 3
      Dockerfile

+ 2 - 3
Dockerfile

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