-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
59 lines (43 loc) · 2.86 KB
/
Copy pathDockerfile
File metadata and controls
59 lines (43 loc) · 2.86 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
# ──────────────────────────────────────────────────────────────────────────────
# Stage 1: builder — install Python dependencies into /install prefix
# This layer is cached as long as requirements.txt doesn't change.
# ──────────────────────────────────────────────────────────────────────────────
FROM python:3.11-slim-bookworm AS builder
WORKDIR /build
COPY requirements.txt ./
RUN pip install --no-cache-dir --prefix=/install -r requirements.txt
# ──────────────────────────────────────────────────────────────────────────────
# Stage 2: base — OS deps + Python packages + Chromium (all slow, all cached)
# Rebuilt only when requirements.txt or system packages change.
# ──────────────────────────────────────────────────────────────────────────────
FROM python:3.11-slim-bookworm AS base
# System dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
ffmpeg \
curl \
yt-dlp \
&& rm -rf /var/lib/apt/lists/*
# Python packages from builder
COPY --from=builder /install /usr/local
# Playwright + Chromium (~300 MB, cached until playwright version changes)
RUN playwright install chromium --with-deps
ENV PLAYWRIGHT_BROWSERS_PATH=/root/.cache/ms-playwright
# ──────────────────────────────────────────────────────────────────────────────
# Stage 3: runtime — only application code (fast, rebuilds in seconds)
# ──────────────────────────────────────────────────────────────────────────────
FROM base AS runtime
WORKDIR /app
# Application code — only this layer changes on every deploy
COPY sberjazz/ ./sberjazz/
COPY ui/ ./ui/
ENV DOCKER_ENV=1 \
BROWSER_HEADLESS=true \
UI_HOST=0.0.0.0 \
UI_PORT=8765 \
PLAYWRIGHT_BROWSERS_PATH=/root/.cache/ms-playwright \
PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1
EXPOSE 8765
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
CMD curl -f http://localhost:8765/api/status || exit 1
CMD ["python", "ui/server.py"]