-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathDockerfile.backend
More file actions
46 lines (37 loc) · 1.84 KB
/
Dockerfile.backend
File metadata and controls
46 lines (37 loc) · 1.84 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
# 使用国内镜像,避免 pull docker.io 超时;可改为 python:3.11-slim(需能访问 Docker Hub)
FROM docker.m.daocloud.io/library/python:3.11-slim
ARG DEBIAN_MIRROR=mirrors.tuna.tsinghua.edu.cn
ARG PYPI_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple
ARG PYPI_FILES_BASE=https://pypi.tuna.tsinghua.edu.cn
WORKDIR /app
# Install system dependencies
# gcc/g++ might be needed for some python packages
# ffmpeg for audio duration detection (TTS video generation)
# Use a configurable mirror; default to Tsinghua to avoid slow deb.debian.org downloads.
RUN sed -i "s|deb.debian.org|${DEBIAN_MIRROR}|g" /etc/apt/sources.list.d/debian.sources && \
apt-get update && apt-get install -y --no-install-recommends \
gcc \
g++ \
ffmpeg \
&& rm -rf /var/lib/apt/lists/*
# Install uv for faster dependency resolution
# Use a configurable PyPI mirror to avoid timeouts to pypi.org/files.pythonhosted.org.
RUN pip install uv -i ${PYPI_INDEX_URL}
# Copy workspace metadata and source
COPY pyproject.toml uv.lock uv.toml /app/
COPY packages/core /app/packages/core
COPY packages/backend /app/packages/backend
# Rewrite the copied uv config/lock to mirror hosts inside the image while keeping the repo source unchanged.
RUN sed -i \
-e "s|https://pypi.org/simple|${PYPI_INDEX_URL}|g" \
-e "s|https://files.pythonhosted.org|${PYPI_FILES_BASE}|g" \
/app/uv.toml /app/uv.lock
# Install backend runtime dependencies from the workspace lock
RUN uv sync --frozen --no-dev --package deepeye-backend --project /app
# Set environment variables
# Include both backend and core in PYTHONPATH to ensure modules are found
ENV PATH=/app/.venv/bin:$PATH
ENV PYTHONPATH=/app/packages/backend:/app/packages/core
ENV PYTHONUNBUFFERED=1
# Default command (will be overridden in docker-compose)
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]