All checks were successful
🚀 Docker Build and Push / build-and-push (push) Successful in 59s
- optimize(docker): use distroless/python3-debian12 & multi-stage build - feat(app): replace Gunicorn with Waitress (pure python) - feat(countries): replace static list with pycountry (dynamic & complete) - feat(config): enforce mandatory APPRISE_URL (fatal if missing) - feat(logging): add structured logging and graceful shutdown signal handling - docs: update README with required env var and correct usage
36 lines
923 B
Docker
36 lines
923 B
Docker
# ------------------------------------
|
|
# Stage 1: Build dependencies
|
|
# ------------------------------------
|
|
FROM python:3.11-slim-bookworm AS builder
|
|
|
|
WORKDIR /build
|
|
COPY requirements.txt .
|
|
|
|
# Install dependencies to a specific directory
|
|
RUN pip install --no-cache-dir --target=/build/packages -r requirements.txt
|
|
|
|
# ------------------------------------
|
|
# Stage 2: Final distroless image
|
|
# ------------------------------------
|
|
# Using Debian 12 (Bookworm) based distroless to match builder
|
|
FROM gcr.io/distroless/python3-debian12
|
|
|
|
WORKDIR /app
|
|
|
|
# Add our packages to python path
|
|
ENV PYTHONPATH=/app/packages
|
|
ENV PYTHONDONTWRITEBYTECODE=1
|
|
ENV PYTHONUNBUFFERED=1
|
|
|
|
# Copy dependencies
|
|
COPY --from=builder /build/packages /app/packages
|
|
|
|
# Copy application code
|
|
COPY app.py .
|
|
|
|
# Expose port (metadata only, distroless doesn't enforce)
|
|
EXPOSE 5000
|
|
|
|
# Run app.py directly (which uses waitress with signal handling)
|
|
CMD ["app.py"]
|