forked from mikepsinn/disease-eradication-plan
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.pdf-build
More file actions
70 lines (55 loc) · 2.33 KB
/
Dockerfile.pdf-build
File metadata and controls
70 lines (55 loc) · 2.33 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
64
65
66
67
68
69
# Dockerfile for PDF build environment
# Pre-installs all dependencies to speed up builds
FROM ubuntu:22.04
# Avoid interactive prompts during package installation
ENV DEBIAN_FRONTEND=noninteractive
# Install system dependencies
RUN apt-get update && apt-get install -y \
wget \
curl \
git \
python3.11 \
python3.11-dev \
python3-pip \
build-essential \
graphviz \
&& rm -rf /var/lib/apt/lists/*
# Install Quarto
RUN curl -LO https://quarto.org/download/latest/quarto-linux-amd64.deb && \
dpkg -i quarto-linux-amd64.deb || apt-get install -f -y && \
rm -f quarto-linux-amd64.deb && \
quarto --version
# Install TinyTeX (lightweight LaTeX distribution)
RUN quarto install tinytex
# Install Chromium (required for PDF rendering with diagrams)
RUN quarto install chromium
# Create cache directories with proper permissions
RUN mkdir -p /tmp/quarto-cache /tmp/deno-cache && \
chmod -R 777 /tmp/quarto-cache /tmp/deno-cache
# Set working directory
WORKDIR /workspace
# Copy requirements first (for better Docker layer caching)
COPY requirements.txt .
# Install Python dependencies using python3.11 explicitly (includes ipykernel)
RUN python3.11 -m pip install --upgrade pip && \
python3.11 -m pip install -r requirements.txt
# Install Jupyter kernel (after dependencies are installed)
RUN python3.11 -m ipykernel install --user --name dih-project-kernel --display-name "DIH Project" || \
python3 -m ipykernel install --user --name dih-project-kernel --display-name "DIH Project"
# Copy project files into container (avoids filesystem mounting issues)
# Copy in stages for better caching
# Copy source files needed for render-book-pdf.py
COPY _quarto-book.yml index-book.qmd ./
COPY _quarto.yml index.qmd styles.css favicon.ico pyproject.toml package.json pnpm-lock.yaml pnpm-workspace.yaml ./
COPY scripts/ scripts/
COPY assets/ assets/
COPY knowledge/ knowledge/
COPY dih_models/ dih_models/
COPY references.bib ./
# Build PDF inside container using render-book-pdf.py
# Use || true to continue even if there are minor cleanup errors
RUN python3.11 scripts/render-book-pdf.py || \
(echo "Build completed with exit code $?" && \
test -f _manual/warondisease/*.pdf && echo "PDF file exists" || echo "No PDF found")
# Output will be in _manual/warondisease/*.pdf
# Use docker cp to extract it after build