chore: use python image 3.13-slim instead of 3.13-alpine

This commit is contained in:
2025-10-01 16:22:48 +02:00
parent 11d9aa0290
commit c21afdebc0
+4 -6
View File
@@ -1,9 +1,10 @@
# Multi-stage build to create a minimal image # Multi-stage build to create a minimal image
FROM python:3.13-alpine AS builder FROM python:3.13-slim AS builder
# Create working directory # Create working directory
WORKDIR /app WORKDIR /app
# poetry export -f requirements.txt --output requirements.txt --without-hashes
# Copy dependency files # Copy dependency files
COPY requirements.txt ./ COPY requirements.txt ./
@@ -11,10 +12,7 @@ COPY requirements.txt ./
RUN pip install --no-cache-dir --no-deps --disable-pip-version-check --target=/app/site-packages -r requirements.txt RUN pip install --no-cache-dir --no-deps --disable-pip-version-check --target=/app/site-packages -r requirements.txt
# Use Alpine as the base image for a much smaller footprint # Use Alpine as the base image for a much smaller footprint
FROM python:3.13-alpine FROM python:3.13-slim
# Install ca-certificates for SSL/HTTPS support and tzdata for timezone support
RUN apk add --no-cache ca-certificates tzdata
# Copy installed packages from builder stage # Copy installed packages from builder stage
COPY --from=builder /app/site-packages /app/site-packages COPY --from=builder /app/site-packages /app/site-packages
@@ -30,7 +28,7 @@ ENV PYTHONPATH=/app/site-packages
WORKDIR /app WORKDIR /app
# Create a non-root user for security # Create a non-root user for security
RUN adduser -D -u 1000 myice RUN useradd --home-dir /app --no-create-home --uid 1000 myice
USER myice USER myice
# Expose port # Expose port