-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
52 lines (40 loc) · 2.05 KB
/
Copy pathDockerfile
File metadata and controls
52 lines (40 loc) · 2.05 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
FROM pandoc/extra:latest-ubuntu
# Install Python, Node.js, and emoji font
# chromium-browser on Ubuntu 24.04 is a snap stub unusable in Docker.
# We use Playwright to install a native Chromium binary (supports ARM64).
RUN apt-get update && apt-get install -y --no-install-recommends \
python3 python3-pip python3-venv \
nodejs npm \
fonts-noto-color-emoji \
# Chromium runtime dependencies (needed by Playwright's Chromium)
libnss3 libatk1.0-0 libatk-bridge2.0-0 libcups2 libdrm2 \
libxkbcommon0 libxcomposite1 libxdamage1 libxrandr2 libgbm1 \
libpango-1.0-0 libcairo2 libasound2t64 libxshmfence1 libxfixes3 \
&& rm -rf /var/lib/apt/lists/*
# Install mermaid-cli (skip Puppeteer's Chromium - wrong arch on ARM)
ENV PUPPETEER_SKIP_DOWNLOAD=true
RUN npm install -g @mermaid-js/mermaid-cli
# Install GitHub markdown CSS
RUN npm install -g github-markdown-css && \
mkdir -p /usr/local/lib/github-css && \
cp $(npm root -g)/github-markdown-css/github-markdown-light.css /usr/local/lib/github-css/
# Install Playwright Chromium (provides native ARM64 binary)
RUN npx --yes playwright install chromium
# Create puppeteer config pointing to Playwright's Chromium
RUN CHROME_PATH=$(find /root/.cache/ms-playwright -name chromium -o -name chrome | grep -E '(chrome|chromium)$' | head -1) && \
echo "{\"executablePath\":\"${CHROME_PATH}\",\"args\":[\"--no-sandbox\"]}" > /usr/local/lib/puppeteer-config.json && \
echo "Chromium path: ${CHROME_PATH}"
# Install uv for fast Python dependency management
RUN pip install --no-cache-dir --break-system-packages uv
WORKDIR /app
# Install Python dependencies
COPY pyproject.toml uv.lock* ./
RUN uv pip install --system --break-system-packages -e .
# Copy application code
COPY . .
EXPOSE 8000
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD python3 -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/', timeout=5)" || exit 1
# Override pandoc entrypoint from base image
ENTRYPOINT []
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]