ig-costing / Dockerfile
imkrish's picture
deploy fe9977fb
ef8983b verified
Raw History Blame Contribute Delete
1.06 kB
# 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"]