| |
| FROM node:20-slim AS frontend-builder |
| WORKDIR /app/frontend |
|
|
| |
| COPY frontend/package.json frontend/package-lock.json ./ |
| RUN npm install --silent |
|
|
| |
| COPY frontend/ ./ |
| RUN npm run build |
|
|
| |
| FROM python:3.11-slim |
| WORKDIR /app |
|
|
| ENV PYTHONDONTWRITEBYTECODE=1 \ |
| PYTHONUNBUFFERED=1 \ |
| TZ=Asia/Shanghai |
|
|
| |
| COPY requirements.txt . |
| RUN apt-get update && \ |
| apt-get install -y --no-install-recommends \ |
| gcc \ |
| curl \ |
| tzdata \ |
| chromium chromium-driver \ |
| dbus dbus-x11 \ |
| xvfb xauth \ |
| libglib2.0-0 libnss3 libnspr4 libatk1.0-0 libatk-bridge2.0-0 \ |
| libcups2 libdrm2 libxkbcommon0 libxcomposite1 libxdamage1 \ |
| libxfixes3 libxrandr2 libgbm1 libasound2 libpango-1.0-0 \ |
| libcairo2 fonts-liberation fonts-noto-cjk && \ |
| ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && \ |
| pip install --no-cache-dir -r requirements.txt && \ |
| apt-get purge -y gcc && \ |
| apt-get autoremove -y && \ |
| rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* |
|
|
| |
| COPY main.py . |
| COPY core ./core |
| COPY util ./util |
|
|
| |
| COPY --from=frontend-builder /app/static ./static |
|
|
| |
| RUN mkdir -p ./data |
|
|
| |
| COPY entrypoint.sh . |
| RUN chmod +x entrypoint.sh |
|
|
| |
| VOLUME ["/app/data"] |
|
|
| |
| EXPOSE 7860 |
|
|
| |
| HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \ |
| CMD curl -f http://localhost:7860/admin/health || exit 1 |
|
|
| |
| CMD ["./entrypoint.sh"] |
|
|