Spaces:
Sleeping
Sleeping
File size: 1,765 Bytes
61ca2b1 0bcdaf3 86cf725 3fe0ef5 86cf725 3fe0ef5 61ca2b1 0999522 61ca2b1 0999522 61ca2b1 0999522 61ca2b1 0999522 61ca2b1 | 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 | FROM python:3.10-slim
# 安装 Nginx
RUN apt-get update && apt-get install -y --no-install-recommends \
curl nginx \
&& rm -rf /var/lib/apt/lists/*
# 安装 Node.js 18
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \
&& apt-get install -y --no-install-recommends nodejs \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# === 前端构建 ===
COPY hf-space/package.json.hf /app/frontend/package.json
RUN cd /app/frontend && npm install
COPY frontend/index.html /app/frontend/
COPY frontend/src /app/frontend/src
COPY frontend/public /app/frontend/public
COPY frontend/postcss.config.js /app/frontend/
COPY frontend/tailwind.config.js /app/frontend/
COPY frontend/tsconfig.json /app/frontend/
COPY frontend/tsconfig.node.json /app/frontend/
COPY frontend/vite.config.ts /app/frontend/
RUN cd /app/frontend && \
sed -i 's/"noUnusedLocals": true/"noUnusedLocals": false/' tsconfig.json && \
sed -i 's/"noUnusedParameters": true/"noUnusedParameters": false/' tsconfig.json && \
npx vite build
# === 后端依赖 ===
COPY hf-space/requirements.txt /app/backend/requirements.txt
RUN pip install --no-cache-dir -r /app/backend/requirements.txt
# === 后端代码 ===
COPY backend/ /app/backend/
# === 补丁 ===
COPY hf-space/patch_celery.py /app/patch_celery.py
COPY hf-space/patch_cors.py /app/patch_cors.py
RUN python3 /app/patch_celery.py && python3 /app/patch_cors.py && rm /app/patch_*.py
# === Nginx ===
RUN rm -f /etc/nginx/sites-enabled/default
COPY nginx.conf /etc/nginx/conf.d/default.conf
# === 启动 ===
COPY hf-space/start.sh /app/start.sh
RUN chmod +x /app/start.sh
ENV WGJY_DATABASE_URL="" \
DATABASE_URL="" \
WGJY_REDIS_URL="" \
WGJY_DB_INTERACTIVE_FIX=0
EXPOSE 7860
CMD ["/app/start.sh"]
|