From f9550c8de8bd1a228d369dbd1201c204ecd24b13 Mon Sep 17 00:00:00 2001 From: William Date: Fri, 1 Jul 2022 16:29:30 +0200 Subject: [PATCH] =?UTF-8?q?Extraction=20de=20la=20r=C3=A9solution=20des=20?= =?UTF-8?q?d=C3=A9pendances=20php=20dans=20un=20autre=20conteneur.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index a5ad5ae..664832b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,15 @@ +FROM php:8.1-cli-alpine as vendor + +WORKDIR /app + +RUN php -r "readfile('http://getcomposer.org/installer');" | php -- --install-dir=/usr/bin/ --filename=composer + +COPY composer.json composer.json +COPY composer.lock composer.lock + +# Install php dependencies +RUN composer install --quiet --no-ansi --no-interaction --no-scripts --no-suggest --no-progress --prefer-dist + FROM php:8.1-apache-buster # Set working directory @@ -40,8 +52,5 @@ RUN apt-get -y autoremove \ # Copy source code COPY --chown=www-data:www-data . /app -# Install php dependencies -RUN composer install --quiet --no-ansi --no-interaction --no-scripts --no-suggest --no-progress --prefer-dist - -# Change vendor permissions -RUN chown www-data:www-data vendor +# Copy vendor +COPY --from=vendor --chown=www-data:www-data /app/vendor/ /app/vendor/