This commit is contained in:
eric
2026-05-16 19:24:30 -05:00
parent 19beec12a5
commit 75a0ca4e31
260 changed files with 51345 additions and 1 deletions

31
d2ypp2/Dockerfile Normal file
View File

@@ -0,0 +1,31 @@
# 生产镜像ffmpeg + 多阶段构建 Next 静态页 + Python API默认端口 8101减少与同机 SRS/代理 冲突)
# docker compose up --build
FROM node:20-bookworm-slim AS console
WORKDIR /src/web-console
COPY web-console/package.json web-console/package-lock.json ./
RUN npm ci
COPY web-console/ ./
RUN npm run build
FROM python:3.12-slim-bookworm
WORKDIR /app
ENV PYTHONDONTWRITEBYTECODE=1 \
PIP_NO_CACHE_DIR=1 \
PORT=8101
RUN apt-get update \
&& apt-get install -y --no-install-recommends ffmpeg ca-certificates \
&& rm -rf /var/lib/apt/lists/* \
&& ffmpeg -version
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
COPY --from=console /src/web-console/out ./web-console/out
# 构建期尝试拉取 scrcpy-server失败不阻断构建容器启动时 lifespan 会再试)
RUN sh -c "python -m src.scrcpy_vendor || echo '[docker] scrcpy-server: build-time fetch skipped'"
EXPOSE 8101
CMD ["sh", "-c", "exec python -m uvicorn web:app --host 0.0.0.0 --port ${PORT}"]