-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathDockerfile
More file actions
61 lines (50 loc) · 3.27 KB
/
Dockerfile
File metadata and controls
61 lines (50 loc) · 3.27 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
# ═══════════════════════════════════════════════════════════════
# Tofu (豆腐) — Docker Image
# ═══════════════════════════════════════════════════════════════
#
# Build: docker build -t tofu .
# Run: docker run -d -p 15000:15000 -v tofu-data:/app/data --name tofu tofu
#
# Or use docker-compose: docker compose up -d
#
# ═══════════════════════════════════════════════════════════════
FROM python:3.12-slim AS base
# ── System dependencies ─────────────────────────────────────
RUN apt-get update && apt-get install -y --no-install-recommends \
# Build tools for compiled Python packages
gcc g++ \
# Playwright / browser automation system deps
libnss3 libnspr4 libatk1.0-0 libatk-bridge2.0-0 \
libcups2 libdrm2 libxkbcommon0 libxcomposite1 \
libxdamage1 libxrandr2 libgbm1 libpango-1.0-0 \
libcairo2 libasound2 libxshmfence1 \
# Fast code search (ripgrep — 5x faster grep, fd-find — 3x faster find)
ripgrep fd-find \
# General utilities
curl ca-certificates git \
&& rm -rf /var/lib/apt/lists/*
# ── App directory ───────────────────────────────────────────
WORKDIR /app
# ── Python dependencies (cached layer) ──────────────────────
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# ── Playwright browser (optional — for advanced page fetching)
RUN pip install --no-cache-dir playwright \
&& playwright install chromium --with-deps 2>/dev/null || true
# ── Copy application code ──────────────────────────────────
COPY . .
# ── Create runtime directories ─────────────────────────────
RUN mkdir -p /app/data /app/logs /app/uploads
# ── Environment defaults ───────────────────────────────────
ENV PORT=15000 \
BIND_HOST=0.0.0.0 \
PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1
# ── Expose port ────────────────────────────────────────────
EXPOSE 15000
# ── Health check ───────────────────────────────────────────
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD curl -f http://localhost:15000/ || exit 1
# ── Entrypoint ─────────────────────────────────────────────
# SQLite auto-creates the database on first run — zero setup needed
CMD ["python", "server.py"]