-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.backend
More file actions
34 lines (24 loc) · 1014 Bytes
/
Dockerfile.backend
File metadata and controls
34 lines (24 loc) · 1014 Bytes
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
# ── Build stage: install Python deps ──
FROM python:3.10-slim AS builder
WORKDIR /app
COPY src-python/requirements-docker.txt .
RUN pip install --no-cache-dir --target=/install -r requirements-docker.txt \
&& find /install -type d -name '__pycache__' -exec rm -rf {} + \
&& find /install -name '*.pyc' -delete \
&& find /install -name '*.pyi' -delete \
&& find /install -name '*.dist-info' -type d -exec rm -rf {} +
# ── Runtime stage ──
FROM python:3.10-slim
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends \
ffmpeg \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /root/.cache
COPY --from=builder /install /usr/local/lib/python3.10/site-packages/
# Selective copy: only .py source + models (skip .venv, build, dist, etc.)
COPY src-python/*.py .
COPY src-python/models/ ./models/
ENV VOICESCRIBE_DATA=/data
ENV PYTHONDONTWRITEBYTECODE=1
EXPOSE 8765
CMD ["python", "-m", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8765"]