git » chasquid » commit 2e6bc52

docker: Set DEBIAN_FRONTEND only during build

author Guiorgy
2025-08-02 20:40:39 UTC
committer Alberto Bertogli
2025-08-03 10:09:46 UTC
parent c6e3fb42b0881e974a8dfff278e31ba2eab67316

docker: Set DEBIAN_FRONTEND only during build

From the Dockerfile docs:

> Environment variable persistence can cause unexpected side effects.
> For example, setting ENV DEBIAN_FRONTEND=noninteractive changes the
> behavior of apt-get, and may confuse users of your image.
>
> If an environment variable is only needed during build, and not in the
> final image, consider setting a value for a single command instead.

So this patch adjusts the use of the DEBIAN_FRONTEND variable to match
the documented best practice.

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

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

docker/Dockerfile +4 -5

diff --git a/docker/Dockerfile b/docker/Dockerfile
index 6088808..f0d1eea 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -17,13 +17,12 @@ RUN go get -d ./... && \
 # Create the image.
 FROM debian:stable
 
-# Make debconf/frontend non-interactive, to avoid distracting output about the
-# lack of $TERM.
-ENV DEBIAN_FRONTEND=noninteractive
-
 # Install the packages we need.
 # This includes chasquid, which sets up good defaults.
-RUN apt-get update -q && \
+# Make debconf/frontend non-interactive, to avoid distracting output about the
+# lack of $TERM.
+RUN DEBIAN_FRONTEND=noninteractive \
+	apt-get update -q && \
 	apt-get install -y -q \
 		chasquid \
 		dovecot-lmtpd dovecot-imapd dovecot-pop3d \