refactor: Standardize user creation in Dockerfile and improve multi-stage build syntax
Some checks failed
Deploy to Production, build images and push to Gitea Registry / build_and_push (pull_request) Failing after 4m40s

This commit is contained in:
mohamad 2025-06-01 15:47:42 +02:00
parent cd98b7b854
commit cc1f910e4c

View File

@ -1,5 +1,5 @@
# Multi-stage build for production
FROM python:alpine as base
FROM python:alpine AS base
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1 \
@ -16,11 +16,12 @@ RUN apk add --no-cache \
postgresql-dev \
curl
# Create non-root user
RUN groupadd -r appuser && useradd -r -g appuser appuser
# Create non-root user (Alpine Linux style)
RUN addgroup -g 1001 -S appuser && \
adduser -u 1001 -S appuser -G appuser
# Development stage
FROM base as development
FROM base AS development
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
@ -30,7 +31,7 @@ USER appuser
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]
# Production stage
FROM base as production
FROM base AS production
WORKDIR /app
# Install production dependencies