Spaces:
Sleeping
Sleeping
Download Dockerfile from WorstCardGame/worst-card-game: direct link, hf CLI and curl.
- Browser
- Download file 1.3 kB
-
https://huggingface.co/spaces/WorstCardGame/worst-card-game/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/WorstCardGame/worst-card-game/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/WorstCardGame/worst-card-game/resolve/main/Dockerfile
1.3 kB
| # HuggingFace Spaces(Docker SDK)— 單容器:Node 同進程服務前端靜態檔 + 鬼影 REST。 | |
| # 前端(web)build 成靜態檔由 server 以 @fastify/static 提供;/api 為鬼影路由。同源、免 CORS。 | |
| FROM node:20-slim | |
| WORKDIR /app | |
| # 先複製 manifest 以利相依層快取 | |
| COPY package.json package-lock.json ./ | |
| COPY packages/battle-core/package.json packages/battle-core/ | |
| COPY packages/web/package.json packages/web/ | |
| COPY packages/server/package.json packages/server/ | |
| RUN npm ci | |
| # 複製原始碼並建置三套件(battle-core 先,web/server 透過其 dist 取用) | |
| COPY . . | |
| RUN npm run build -w @wcg/battle-core \ | |
| && npm run build -w @wcg/web \ | |
| && npm run build -w @wcg/server | |
| ENV NODE_ENV=production \ | |
| PORT=7860 \ | |
| WEB_ROOT=/app/packages/web/dist \ | |
| GHOSTS_FILE=/tmp/ghosts.json | |
| # 鬼影儲存: | |
| # - 預設 GHOSTS_FILE=/tmp/ghosts.json 是「短暫」的,Space 重啟/重建會清空。 | |
| # - 免費永久保存(推薦):在 HF Space Secrets 設 UPSTASH_REDIS_REST_URL + UPSTASH_REDIS_REST_TOKEN | |
| # (https://console.upstash.com 建免費 Redis,複製 REST API 的 URL/TOKEN),server 會自動改用 Upstash、跨重啟保存。 | |
| # - 或開 HF Persistent Storage(付費)並改 GHOSTS_FILE=/data/ghosts.json。 | |
| EXPOSE 7860 | |
| CMD ["node", "packages/server/dist/index.js"] | |