Skip to content

Commit ac0c16a

Browse files
PeterDaveHelloAntoLC
authored andcommitted
⚡️(docker) Optimize Dockerfile to use apk with --no-cache
Using the `apk` commands with the `--no-cache` parameter for package installation and upgrade will prevent the package index from being cached and reduce the built image size.
1 parent ca09f9a commit ac0c16a

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ and this project adheres to
88

99
## [Unreleased]
1010

11+
### Changed
12+
13+
- ⚡️(docker) Optimize Dockerfile to use apk with --no-cache #743
14+
1115
## [3.4.1] - 2025-07-15
1216

1317
### Fixed

Dockerfile

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ FROM python:3.13.3-alpine AS base
77
RUN python -m pip install --upgrade pip setuptools
88

99
# Upgrade system packages to install security updates
10-
RUN apk update && \
11-
apk upgrade
10+
RUN apk update && apk upgrade --no-cache
1211

1312
# ---- Back-end builder image ----
1413
FROM base AS back-builder
@@ -45,7 +44,7 @@ FROM base AS link-collector
4544
ARG IMPRESS_STATIC_ROOT=/data/static
4645

4746
# Install pango & rdfind
48-
RUN apk add \
47+
RUN apk add --no-cache \
4948
pango \
5049
rdfind
5150

@@ -71,7 +70,7 @@ FROM base AS core
7170
ENV PYTHONUNBUFFERED=1
7271

7372
# Install required system libs
74-
RUN apk add \
73+
RUN apk add --no-cache \
7574
cairo \
7675
file \
7776
font-noto \
@@ -117,7 +116,7 @@ FROM core AS backend-development
117116
USER root:root
118117

119118
# Install psql
120-
RUN apk add postgresql-client
119+
RUN apk add --no-cache postgresql-client
121120

122121
# Uninstall impress and re-install it in editable mode along with development
123122
# dependencies

0 commit comments

Comments
 (0)