File size: 1,059 Bytes
020ed68
 
 
 
 
 
 
 
 
 
 
 
2da9428
020ed68
2da9428
 
020ed68
 
 
ef8983b
 
2da9428
020ed68
2da9428
020ed68
 
 
 
 
2da9428
 
020ed68
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
# Costing ingest + query server for a Hugging Face Space.
#
# Stateless by design: MongoDB lives in Atlas, not in here. Nothing on this
# container's disk needs to survive a restart, so there is no restore-on-boot,
# no shutdown dump, and no backup machinery. Push changes whenever you like.

FROM node:22-bookworm-slim AS build
WORKDIR /build
COPY package.json package-lock.json ./
RUN npm ci
COPY . .
RUN BUILD_TARGET=space npm run build

FROM node:22-bookworm-slim
WORKDIR /app

# HF Spaces run the container as uid 1000; the node image already has that user.
COPY --from=build --chown=node:node /build/.next/standalone ./
COPY --from=build --chown=node:node /build/.next/static ./.next/static
# No public/ copy: static assets live in ../frontend, and this Space serves only
# API routes. Copying a directory that doesn't exist fails the Docker build.

USER node

# TZ is pinned because several routes derive "today" from local server time.
ENV TZ=UTC \
    NODE_ENV=production \
    PORT=7860 \
    HOSTNAME=0.0.0.0

EXPOSE 7860
CMD ["node", "server.js"]