Download Dockerfile from build-small-hackathon/field-guide: direct link, hf CLI and curl.
- Browser
- Download file 1.12 kB
-
https://huggingface.co/spaces/build-small-hackathon/field-guide/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/build-small-hackathon/field-guide/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/build-small-hackathon/field-guide/resolve/main/Dockerfile
1.12 kB
| # syntax=docker/dockerfile:1 | |
| # ---------- build stage ---------- | |
| FROM node:22-slim AS builder | |
| WORKDIR /app | |
| # Enable pnpm via corepack | |
| RUN corepack enable | |
| # Install dependencies first so they cache across source-only changes | |
| COPY package.json pnpm-lock.yaml ./ | |
| RUN pnpm install --frozen-lockfile | |
| # Build the SvelteKit app -> build/ (adapter-node) | |
| COPY . . | |
| RUN pnpm run build | |
| # ---------- run stage ---------- | |
| FROM node:22-slim AS runner | |
| # The node image already ships a non-root `node` user at UID 1000 — exactly what | |
| # HF Spaces expects. Reuse it rather than creating a colliding user. | |
| RUN corepack enable | |
| WORKDIR /home/node/app | |
| RUN chown -R node:node /home/node/app | |
| USER node | |
| ENV HOME=/home/node \ | |
| PATH=/home/node/.local/bin:$PATH | |
| # Production dependencies only (the `prepare` script no-ops without devDeps) | |
| COPY --chown=node package.json pnpm-lock.yaml ./ | |
| RUN pnpm install --prod --frozen-lockfile | |
| # Built standalone Node server + prerendered assets | |
| COPY --chown=node --from=builder /app/build ./build | |
| ENV NODE_ENV=production \ | |
| PORT=7860 \ | |
| HOST=0.0.0.0 | |
| EXPOSE 7860 | |
| CMD ["node", "build/index.js"] | |