# Multi-stage build to create a minimal image FROM python:3.13-alpine AS builder # Create working directory WORKDIR /app # Copy dependency files COPY requirements.txt ./ # Install dependencies to a target directory 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 FROM python:3.13-alpine # 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 --from=builder /app/site-packages /app/site-packages # Copy application code COPY index.html favicon.ico /app/ COPY myice /app/myice # Set PYTHONPATH so Python can find our installed packages ENV PYTHONPATH=/app/site-packages # Set working directory WORKDIR /app # Create a non-root user for security RUN adduser -D -u 1000 myice USER myice # Expose port EXPOSE 8000 # Run the application ENTRYPOINT ["python", "-m", "uvicorn", "myice.webapi:app", "--host", "0.0.0.0", "--port", "8000"]