FROM python:3.9-alpine AS builder WORKDIR /app # Install build dependencies (needed for some Python packages) RUN apk add --no-cache gcc musl-dev linux-headers COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt COPY . . FROM python:3.9-alpine WORKDIR /app # Install runtime dependencies if needed (uncomment if your app needs them) # RUN apk add --no-cache libstdc++ COPY --from=builder /app /app CMD ["python", "app.py"]