feat: 增加Docker容器环境

This commit is contained in:
听风
2025-11-06 14:50:19 +08:00
parent 7de1a30b92
commit de2389c9b1
14 changed files with 135 additions and 41 deletions
+56
View File
@@ -0,0 +1,56 @@
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
RUN npm run build
FROM python:3.10.19
WORKDIR /app
ENV PLAYWRIGHT_BROWSERS_PATH=/opt/playwright
COPY --from=builder /app/dist/index.html /app
COPY --from=builder /app/dist/assets /app/assets
COPY --from=builder /app/dist/vite.svg /app
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 . .
RUN cp conf.example.py conf.py
EXPOSE 80
EXPOSE 5409
CMD ["python", "sau_backend.py"]