-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
63 lines (49 loc) · 2.11 KB
/
Copy pathDockerfile
File metadata and controls
63 lines (49 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# ── Stage 1: Builder ─────────────────────────────────────────────────────
FROM python:3.12-slim AS builder
WORKDIR /build
# Install build dependencies for native extensions (psycopg, etc.)
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
libpq-dev \
&& rm -rf /var/lib/apt/lists/*
COPY pyproject.toml ./
RUN pip install --no-cache-dir --prefix=/install ".[preview]"
# ── Stage 2: Runtime ─────────────────────────────────────────────────────
FROM python:3.12-slim AS runtime
# System dependencies:
# chromium — Kaleido/Plotly static chart rendering
# fonts-* — TrueType fonts for headless text measurement
# libpq-dev — PostgreSQL client library for psycopg
# libreoffice-impress — headless PPTX-to-PDF for thumbnail generation
# poppler-utils — PDF-to-PNG conversion (pdf2image)
RUN apt-get update && apt-get install -y --no-install-recommends \
chromium \
fonts-liberation \
fonts-dejavu-core \
fonts-open-sans \
fontconfig \
libpq-dev \
libreoffice-impress \
poppler-utils \
&& rm -rf /var/lib/apt/lists/* \
&& fc-cache -f
ENV CHROME_PATH=/usr/bin/chromium
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
# Non-root user for security
RUN useradd --create-home --shell /bin/bash deckforge
WORKDIR /app
# Copy installed packages from builder
COPY --from=builder /install /usr/local
# Copy application code
COPY src/ src/
COPY alembic/ alembic/
COPY alembic.ini .
# Copy theme YAML files (ensure they are included even if src/ COPY missed them)
COPY src/deckforge/themes/data/ src/deckforge/themes/data/
RUN chown -R deckforge:deckforge /app
USER deckforge
EXPOSE 8000
HEALTHCHECK --interval=30s --timeout=5s --retries=3 \
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/v1/health')"
CMD ["uvicorn", "deckforge.main:app", "--host", "0.0.0.0", "--port", "8000"]