gridloc / Dockerfile
lassanmonster's picture
GridLoc: Bengaluru parking congestion digital twin
db3dbe1
Raw
History Blame Contribute Delete
1.03 kB
# syntax=docker/dockerfile:1
# ---------- Build stage ----------
# Compiles the TanStack Start app: static client (dist/client) + SSR handler
# (dist/server/server.js).
FROM node:22-slim AS build
WORKDIR /app
# Install dependencies first so this layer is cached unless the lockfile changes.
COPY package.json package-lock.json ./
RUN npm ci
# Copy the rest of the source and build. The prebuild step regenerates the
# Bengaluru boundary, then `vite build` emits dist/.
COPY . .
RUN npm run build
# ---------- Runtime stage ----------
# Ships the built app plus only the production dependencies the SSR handler
# imports at runtime, and the small Node host that serves it.
FROM node:22-slim AS runtime
WORKDIR /app
ENV NODE_ENV=production
# Hugging Face Spaces routes incoming traffic to this port.
ENV PORT=7860
ENV HOST=0.0.0.0
COPY package.json package-lock.json ./
RUN npm ci --omit=dev && npm cache clean --force
COPY --from=build /app/dist ./dist
COPY server.mjs ./server.mjs
EXPOSE 7860
CMD ["node", "server.mjs"]