From 59fa9fb3ab6d19a691749c02b4583f70f56d14f7 Mon Sep 17 00:00:00 2001 From: Gereon Frey Date: Sun, 24 Feb 2019 14:21:52 +0100 Subject: [PATCH] Optimize Dockerfile This change will only copy the `compose.{json|lock}` files prior to installing the dependencies. This improves container image build time when only code changed, as it facilitates image caching. --- Dockerfile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index b829e2c..2ad0ddf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,18 +13,19 @@ WORKDIR /daux COPY --from=composer /usr/bin/composer /usr/bin/composer # Copy files +COPY composer.json /daux/composer.json +COPY composer.lock /daux/composer.lock + +RUN composer install --prefer-dist --no-ansi --no-dev --no-interaction --no-progress --no-scripts --optimize-autoloader + COPY bin/ /daux/bin/ COPY libs/ /daux/libs/ COPY templates/ /daux/templates/ COPY themes/ /daux/themes/ COPY tipuesearch/ /daux/tipuesearch/ COPY global.json /daux/global.json -COPY composer.json /daux/composer.json -COPY composer.lock /daux/composer.lock COPY index.php /daux/index.php -RUN composer install --prefer-dist --no-ansi --no-dev --no-interaction --no-progress --no-scripts --optimize-autoloader - RUN ln -s /daux/bin/daux /usr/local/bin/daux WORKDIR /build