From 93a9e030262a436e2ab12f4f50da3aa4957ca19b Mon Sep 17 00:00:00 2001 From: rjshrjndrn Date: Thu, 13 Mar 2025 13:33:49 +0100 Subject: [PATCH] fix(api): improve Dockerfile with best practices - Use lowercase labels in accordance with Docker conventions - Pin package versions for better build reproducibility - Consolidate RUN commands to reduce image layers - Use JSON array notation for CMD instruction - Restore GIT_SHA label for proper image versioning - Maintain consistent code formatting and ordering Signed-off-by: rjshrjndrn --- api/Dockerfile | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/api/Dockerfile b/api/Dockerfile index 232805144..6ed123e4d 100644 --- a/api/Dockerfile +++ b/api/Dockerfile @@ -1,10 +1,9 @@ FROM python:3.12-alpine -LABEL Maintainer="Rajesh Rajendran" -LABEL Maintainer="KRAIEM Taha Yassine" -ARG GIT_SHA -LABEL GIT_SHA=$GIT_SHA +LABEL maintainer="Rajesh Rajendran" +LABEL maintainer="KRAIEM Taha Yassine" -RUN apk add --no-cache build-base tini +RUN apk add --no-cache build-base=~1.2 tini=~0.19 +ARG GIT_SHA ARG envarg # Add Tini # Startup daemon @@ -17,16 +16,15 @@ ENV SOURCE_MAP_VERSION=0.7.4 \ WORKDIR /work COPY requirements.txt ./requirements.txt -RUN pip install --no-cache-dir --upgrade uv -RUN uv pip install --no-cache-dir --upgrade pip setuptools wheel --system -RUN uv pip install --no-cache-dir --upgrade -r requirements.txt --system +RUN pip install --no-cache-dir --upgrade uv && \ + uv pip install --no-cache-dir --upgrade pip setuptools wheel --system && \ + uv pip install --no-cache-dir --upgrade -r requirements.txt --system COPY . . -RUN mv env.default .env - -RUN adduser -u 1001 openreplay -D +RUN mv env.default .env && \ + adduser -u 1001 openreplay -D USER 1001 ENTRYPOINT ["/sbin/tini", "--"] -CMD ./entrypoint.sh +CMD ["./entrypoint.sh"]