Spaces:
Sleeping
Sleeping
Download Dockerfile from shaun07/grid-backtest: direct link, hf CLI and curl.
- Browser
- Download file 1.77 kB
-
https://huggingface.co/spaces/shaun07/grid-backtest/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/shaun07/grid-backtest/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/shaun07/grid-backtest/resolve/main/Dockerfile
1.77 kB
| 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"] | |