git » chasquid » commit c6e3fb4

docker: Cleanup apt packages and cache in build

author Guiorgy
2025-08-02 18:06:59 UTC
committer Alberto Bertogli
2025-08-03 10:09:12 UTC
parent 68ba0d2600b5b25abe8e91fb4bca5a07fc30d586

docker: Cleanup apt packages and cache in build

This patch makes Docker build clean up the apt packages and cache, to
reduce the size of the final image.

https://github.com/albertito/chasquid/pull/68

Amended-by: Alberto Bertogli <albertito@blitiri.com.ar>
  Adjusted commit message.

docker/Dockerfile +4 -1

diff --git a/docker/Dockerfile b/docker/Dockerfile
index 5dc1c2d..6088808 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -28,7 +28,10 @@ RUN apt-get update -q && \
 		chasquid \
 		dovecot-lmtpd dovecot-imapd dovecot-pop3d \
 		dovecot-sieve dovecot-managesieved \
-		acl libcap2-bin sudo certbot
+		acl libcap2-bin sudo certbot && \
+	apt-get autoremove --purge -y -q && \
+	apt-get autoclean -y -q && \
+	rm -rf /var/lib/apt/lists/*
 
 # Copy the binaries. This overrides the debian packages with the ones we just
 # built above.