Spaces:
Paused
Paused
Download Dockerfile from tanlang002/tupload07: direct link, hf CLI and curl.
- Browser
- Download file 1.43 kB
-
https://huggingface.co/spaces/tanlang002/tupload07/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/tanlang002/tupload07/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/tanlang002/tupload07/resolve/main/Dockerfile
1.43 kB
| # 笔趣阁阅读 一键部署(单容器) | |
| # - 阶段 1:构建 React 前端(novel-reader -> dist) | |
| # - 阶段 2:FastAPI 后端 + 托管 dist,整体监听 7860 | |
| # | |
| # 本地构建(本机连不上 Docker Hub 时可用镜像源): | |
| # docker build --build-arg PYTHON_IMAGE=dockerproxy.net/library/python:3.12-slim \ | |
| # --build-arg NODE_IMAGE=dockerproxy.net/library/node:20-alpine \ | |
| # -t biquge-all . | |
| # 运行: | |
| # docker run -d -p 7860:7860 -v biquge_data:/data --name biquge biquge-all | |
| ARG PYTHON_IMAGE=python:3.12-slim | |
| ARG NODE_IMAGE=node:20-alpine | |
| FROM ${NODE_IMAGE} AS frontend-build | |
| WORKDIR /build/frontend | |
| COPY novel-reader/package.json novel-reader/package-lock.json ./ | |
| RUN npm install --no-audit --no-fund | |
| COPY novel-reader/ ./ | |
| RUN npm run build | |
| FROM ${PYTHON_IMAGE} | |
| ENV PYTHONUNBUFFERED=1 \ | |
| PIP_NO_CACHE_DIR=1 \ | |
| PORT=7860 \ | |
| STATIC_DIR=/app/static \ | |
| READER_DB_PATH=/data/reader.db \ | |
| CHAPTER_CACHE_DB_PATH=/data/chapter_cache.db | |
| WORKDIR /app/backend | |
| COPY biquge-api/requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| COPY biquge-api/app ./app | |
| COPY biquge-api/sites ./sites | |
| # 前端打包产物 -> FastAPI 静态托管目录 | |
| COPY --from=frontend-build /build/frontend/dist /app/static | |
| # HF Spaces / 持久化数据目录 | |
| RUN mkdir -p /data | |
| EXPOSE 7860 | |
| CMD ["sh", "-c", "exec uvicorn app.main:app --host 0.0.0.0 --port ${PORT:-7860}"] | |