Skip to content

Commit 9e8c17d

Browse files
committed
chore: reduce image size by removing unused packages
1 parent 8e33f56 commit 9e8c17d

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# CHANGELOG
22

3+
## 29 (2025-05-28)
4+
5+
- Removes `git` and `unzip` packages as they were unused to reduce image size
6+
- Removes `*-dev` packages after build to reduce image size
7+
38
## 28 (2025-04-03)
49

510
- Bumps `max_requests` from `500` to `1000`

Dockerfile

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,30 @@ SHELL ["/bin/ash", "-o", "pipefail", "-c"]
1010
# If a package is not pinned, it's due to transient version needs per PHP version used
1111
# hadolint ignore=DL3018
1212
RUN apk add --no-cache --update \
13-
# Install packages required by PHP/Laravel
14-
git~=2 \
15-
icu-dev \
13+
# Install nginx to serve the application
1614
nginx~=1 \
15+
# Install Laravel dependencies
16+
icu-dev \
17+
# Install JS dependencies
1718
nodejs~=22 \
18-
# Installing npm must occur after nodejs to ensure it uses our pinned nodejs version
1919
npm \
20-
unzip~=6 \
2120
# Install mail server
2221
msmtp~=1 \
2322
# Install gd for image functionality
23+
freetype~=2 \
2424
freetype-dev~=2 \
25+
libjpeg-turbo~=3 \
2526
libjpeg-turbo-dev~=3 \
27+
libpng~=1 \
2628
libpng-dev~=1 \
29+
libwebp~=1 \
2730
libwebp-dev~=1 \
2831
# Install zip for csv functionality
32+
libzip~=1 \
2933
libzip-dev~=1 \
34+
zlib~=1 \
35+
zlib-dev~=1 \
3036
zip~=3 \
31-
# Cleanup apk add
32-
&& rm -rf /var/cache/apk/* /tmp/* \
3337
# Configure image library
3438
&& docker-php-ext-configure gd \
3539
--with-jpeg \
@@ -43,6 +47,10 @@ RUN apk add --no-cache --update \
4347
opcache \
4448
pdo_mysql \
4549
zip \
50+
# Remove dev packages once we're done using them
51+
&& apk del icu-dev freetype-dev libjpeg-turbo-dev libpng-dev libwebp-dev libzip-dev \
52+
# Cleanup apk add
53+
&& rm -rf /var/cache/apk/* /tmp/* \
4654
# Setup directories and permissions
4755
&& mkdir -p /var/run/nginx /var/run/php-fpm \
4856
&& chown -R www-data:www-data /var/run/nginx /var/run/php-fpm /var/lib/nginx /var/log/nginx \

0 commit comments

Comments
 (0)