From 2c99799d4db5875391285dfbe686b0ee1c5253a1 Mon Sep 17 00:00:00 2001 From: Benjamin Bach Date: Tue, 23 Jul 2024 22:48:24 +0000 Subject: [PATCH] Shorten and document Docker tweaks for Python and pip (#35) Wanted to use some of the setup for bootstrapping another project, so I had a close look over these couple of items. Reviewed-on: https://git.data.coop/data.coop/membersystem/pulls/35 Reviewed-by: valberg Co-authored-by: Benjamin Bach Co-committed-by: Benjamin Bach --- Dockerfile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index fe342b7..fc8aa79 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,15 @@ FROM python:3.12-slim-bullseye +# PYTHONFAULTHANDLER: Propagate tracebacks from all threads. +# PYTHONUNBUFFERED: Write terminal output straight to docker (to not confuse Docker Compose). +# PYTHONDONTWRITEBYTECODE: Dont write *pyc files at all, making it possible for a 100% read-only container. +# PIP_NO_CACHE_DIR: Disable PIP cache, we don't need pip's cache after building the image. +# PIP_DISABLE_PIP_VERSION_CHECK: Build the image with the available pip, do not check for updates (faster!) +# PIP_DEFAULT_TIMEOUT: Allow for longer timeouts. ENV PYTHONFAULTHANDLER=1 \ PYTHONUNBUFFERED=1 \ PYTHONDONTWRITEBYTECODE=1 \ - PYTHONHASHSEED=random \ - PIP_NO_CACHE_DIR=off \ + PIP_NO_CACHE_DIR=1 \ PIP_DISABLE_PIP_VERSION_CHECK=on \ PIP_DEFAULT_TIMEOUT=100 ARG BUILD