File size: 1,423 Bytes
a960ffe
f748362
 
 
 
 
 
 
 
 
 
 
 
a206d0f
f748362
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a960ffe
 
 
 
f748362
 
a960ffe
 
 
175da6d
 
f748362
 
 
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
62
FROM node:22.21.1 AS builder

WORKDIR /app

RUN npm config set registry https://registry.npmmirror.com

COPY sau_frontend .

RUN npm install

ENV NODE_ENV=production
ENV PATH=/app/node_modules/.bin:$PATH

# 生产构建:.env.production 中 VITE_API_BASE_URL 为空,前端与 Flask 同源(见 sau_frontend/src/utils/apiBase.js)
RUN npm run build


FROM python:3.10.19

WORKDIR /app

ENV PLAYWRIGHT_BROWSERS_PATH=/opt/playwright

RUN apt-get update && apt-get install -y --no-install-recommends libnss3 \
    libnspr4 \
    libdbus-1-3 \
    libatk1.0-0 \
    libatk-bridge2.0-0 \
    libatspi2.0-0 \
    libxcomposite1 \
    libxdamage1 \
    libxfixes3 \
    libxrandr2 \
    libgbm1 \
    libxkbcommon0 \
    libasound2 && rm -rf /var/lib/apt/lists/*

RUN pip config set global.index-url https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple

COPY requirements.txt requirements.txt

RUN pip install -r requirements.txt

RUN playwright install chromium-headless-shell

COPY . .

COPY --from=builder /app/dist/index.html /app
COPY --from=builder /app/dist/assets /app/assets
COPY --from=builder /app/dist/vite.svg /app/assets

RUN cp conf.example.py conf.py

RUN mkdir -p /app/videoFile
RUN mkdir -p /app/cookiesFile

# Hugging Face Spaces:README 中 app_port 须与此端口一致;也可在 Space 设置里改 app_port 并同步设置环境变量 PORT
ENV PORT=5409
EXPOSE 5409

CMD ["python", "sau_backend.py"]