From d2354523029a96bf5b8607c6f87ad6050a7f278b Mon Sep 17 00:00:00 2001 From: Dave Webb Date: Thu, 29 Sep 2022 22:03:40 +1300 Subject: [PATCH] Copy h-m-m to image as one of the final steps of the build Each edit to the h-m-m script was triggering a full image rebuild, including the slow apt-get and docker-php-ext-install steps. I figure that the h-m-m script itself is more likely to change than the system installs. Moving the COPY to after those operations means that each time h-m-m changes, the `docker build` can use the cache for the slow operations, and just add a new layer for the COPY at the end. Plus `chmod +x h-m-m` is unnecessary as h-m-m already has the executable bit set. --- Dockerfile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 799d872..baacfe0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,14 +2,12 @@ FROM php:cli WORKDIR /app -COPY ./h-m-m . - RUN apt-get update \ && apt-get install -y --no-install-recommends \ libonig-dev xclip xsel wl-clipboard RUN docker-php-ext-install mbstring -RUN chmod +x h-m-m +COPY ./h-m-m . CMD ["./h-m-m"]