Spaces:
Sleeping
Sleeping
File size: 786 Bytes
9b54db2 | 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 | # ---- Build stage ----
FROM node:20-slim AS builder
WORKDIR /app
# Copy lockfile + manifest first for layer-cache efficiency
COPY package.json package-lock.json ./
# Reproducible install (includes devDeps needed for vite build)
RUN npm ci
# Copy source
COPY . .
# Build the React frontend → dist/
RUN npm run build
# ---- Runtime stage ----
FROM node:20-slim
WORKDIR /app
COPY package.json package-lock.json ./
# Production + tsx needed for server runtime
RUN npm ci
# Bring in the compiled frontend and server source
COPY --from=builder /app/dist ./dist
COPY server.ts ./
# Hugging Face Spaces requires port 7860
EXPOSE 7860
# HF_TOKEN must be added as a Repository Secret in Space settings
# It is read at runtime via process.env.HF_TOKEN
CMD ["npm", "run", "server"]
|