Skip to content

Commit 2a74277

Browse files
authored
Add optimisations to dockerfile (#4191)
Separate and delete build dependencies, add .dockerignore file
1 parent 089a2f6 commit 2a74277

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

.dockerignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*
2+
!.dockerignore
3+
!Dockerfile
4+
!deployer.phar

.github/workflows/docker.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,7 @@ jobs:
6969
platforms: linux/amd64,linux/arm64
7070
push: true
7171
provenance: true
72+
cache-from: type=gha
73+
cache-to: type=gha,mode=max
7274
tags: ${{ steps.meta.outputs.tags }}
7375
labels: ${{ steps.meta.outputs.labels }}

Dockerfile

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
11
FROM php:8.4-cli-alpine
22

3-
RUN apk update && apk add --no-cache linux-headers bash git openssh-client rsync zip unzip libzip-dev curl-dev
4-
5-
RUN docker-php-ext-install pcntl sockets curl zip
3+
RUN set -eux; \
4+
apk add --no-cache \
5+
bash \
6+
git \
7+
libzip \
8+
openssh-client \
9+
rsync \
10+
unzip \
11+
zip; \
12+
apk add --no-cache --virtual .build-deps \
13+
libzip-dev \
14+
linux-headers; \
15+
docker-php-ext-install -j"$(nproc)" pcntl sockets zip; \
16+
apk del .build-deps
617

718
COPY --chmod=755 deployer.phar /bin/dep
819

0 commit comments

Comments
 (0)