From 6689df7d1cb0088992f18d302df1548aab9f12ac Mon Sep 17 00:00:00 2001
From: Mohammad Torkashvand <mohammad.torkashvand@geant.org>
Date: Fri, 13 Dec 2024 14:14:13 +0100
Subject: [PATCH] Add environment variables for Python logging and UTF-8
 support in Alpine image

---
 Dockerfile | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/Dockerfile b/Dockerfile
index 646bd9f1..40a48076 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,12 +1,18 @@
 FROM python:3.12.7-alpine
 WORKDIR /app
 
+# Set environment variables for predictable Python behavior and UTF-8 encoding
+ENV PYTHONUNBUFFERED=1 \
+    PYTHONDONTWRITEBYTECODE=1 \
+    LANG=C.UTF-8 \
+    LC_ALL=C.UTF-8
+
 ARG ARTIFACT_VERSION
 
 RUN apk add --no-cache gcc libc-dev libffi-dev curl vim && \
     addgroup -S appgroup && adduser -S appuser -G appgroup -h /app
 
-RUN pip install \
+RUN pip install --no-cache-dir \
     --pre \
     --trusted-host 150.254.211.2 \
     --extra-index-url https://150.254.211.2/artifactory/api/pypi/geant-swd-pypi/simple \
@@ -19,7 +25,7 @@ ENV TRANSLATIONS_DIR=/app/gso/translations/
 # Copy the shell scripts and ensure scripts do not have Windows line endings and make them executable
 COPY start-app.sh start-worker.sh start-scheduler.sh /app/
 RUN sed -i 's/\r$//' start-app.sh start-worker.sh start-scheduler.sh && \
-    chmod 755 start-app.sh start-worker.sh start-scheduler.sh
+    chmod +x start-app.sh start-worker.sh start-scheduler.sh
 
 RUN chown -R appuser:appgroup /app
 USER appuser
-- 
GitLab