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 <rjshrjndrn@gmail.com>
This commit is contained in:
rjshrjndrn 2025-03-13 13:33:49 +01:00
parent a62f6f6bb0
commit 93a9e03026

View file

@ -1,10 +1,9 @@
FROM python:3.12-alpine FROM python:3.12-alpine
LABEL Maintainer="Rajesh Rajendran<rjshrjndrn@gmail.com>" LABEL maintainer="Rajesh Rajendran<rjshrjndrn@gmail.com>"
LABEL Maintainer="KRAIEM Taha Yassine<tahayk2@gmail.com>" LABEL maintainer="KRAIEM Taha Yassine<tahayk2@gmail.com>"
ARG GIT_SHA
LABEL GIT_SHA=$GIT_SHA
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 ARG envarg
# Add Tini # Add Tini
# Startup daemon # Startup daemon
@ -17,16 +16,15 @@ ENV SOURCE_MAP_VERSION=0.7.4 \
WORKDIR /work WORKDIR /work
COPY requirements.txt ./requirements.txt COPY requirements.txt ./requirements.txt
RUN pip install --no-cache-dir --upgrade uv RUN pip install --no-cache-dir --upgrade uv && \
RUN uv pip install --no-cache-dir --upgrade pip setuptools wheel --system uv pip install --no-cache-dir --upgrade pip setuptools wheel --system && \
RUN uv pip install --no-cache-dir --upgrade -r requirements.txt --system uv pip install --no-cache-dir --upgrade -r requirements.txt --system
COPY . . COPY . .
RUN mv env.default .env RUN mv env.default .env && \
adduser -u 1001 openreplay -D
RUN adduser -u 1001 openreplay -D
USER 1001 USER 1001
ENTRYPOINT ["/sbin/tini", "--"] ENTRYPOINT ["/sbin/tini", "--"]
CMD ./entrypoint.sh CMD ["./entrypoint.sh"]