-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
56 lines (48 loc) · 1.74 KB
/
Copy pathDockerfile
File metadata and controls
56 lines (48 loc) · 1.74 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
# HalfSeed backend image.
# Includes a TeX Live install with xeCJK + macOS-equivalent CJK fonts so the
# LaTeX gate can compile papers/slides containing Chinese characters.
FROM python:3.13-slim
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
HALFSEED_RUN_DIR=/app/runs
# System deps: latexmk + xelatex + xeCJK + a CJK-capable font set.
# texlive-xetex pulls fontspec; texlive-lang-chinese provides ctex/xeCJK; the
# Noto CJK font is the fallback HalfSeed's paper template uses on Linux.
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
git \
latexmk \
texlive-xetex \
texlive-fonts-recommended \
texlive-fonts-extra \
texlive-latex-recommended \
texlive-latex-extra \
texlive-lang-chinese \
fonts-noto-cjk \
fonts-noto-cjk-extra \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Install Python deps first so the layer caches when only source changes.
COPY pyproject.toml README.md ./
COPY src/halfseed/__init__.py ./src/halfseed/__init__.py
RUN pip install --no-cache-dir -e .
# Scientific stack the sandbox advertises in DEFAULT_ALLOWED_IMPORTS.
# Without these the Numerical agent's first line (typically `import numpy`)
# crashes with ModuleNotFoundError before it can do anything useful. We
# install them in a separate layer so changing application source does
# not invalidate this slow ~150 MB install.
RUN pip install --no-cache-dir \
numpy \
scipy \
sympy \
matplotlib \
pandas \
h5py \
networkx
# Now copy the rest of the source.
COPY src/ ./src/
COPY examples/ ./examples/
COPY docs/ ./docs/
EXPOSE 8000
CMD ["python", "-m", "halfseed", "serve", "--host", "0.0.0.0", "--port", "8000"]