From feb577a46566a12f33c52affc808968f5ceb4838 Mon Sep 17 00:00:00 2001 From: Daniel Dorndorf Date: Sun, 12 Apr 2026 21:10:46 +0200 Subject: [PATCH] Add optimisations to dockerfile Separate and delete build dependencies, add .dockerignore file --- .dockerignore | 4 ++++ .github/workflows/docker.yaml | 2 ++ Dockerfile | 17 ++++++++++++++--- 3 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..2602e3e44 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +* +!.dockerignore +!Dockerfile +!deployer.phar diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index e7958251d..14a25b569 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -69,5 +69,7 @@ jobs: platforms: linux/amd64,linux/arm64 push: true provenance: true + cache-from: type=gha + cache-to: type=gha,mode=max tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} diff --git a/Dockerfile b/Dockerfile index 29c53e494..234eaeec2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,19 @@ FROM php:8.4-cli-alpine -RUN apk update && apk add --no-cache linux-headers bash git openssh-client rsync zip unzip libzip-dev curl-dev - -RUN docker-php-ext-install pcntl sockets curl zip +RUN set -eux; \ + apk add --no-cache \ + bash \ + git \ + libzip \ + openssh-client \ + rsync \ + unzip \ + zip; \ + apk add --no-cache --virtual .build-deps \ + libzip-dev \ + linux-headers; \ + docker-php-ext-install -j"$(nproc)" pcntl sockets zip; \ + apk del .build-deps COPY --chmod=755 deployer.phar /bin/dep