NEXUS-AI / Dockerfile
Mati83moni's picture
Fix Dockerfile: use existing node user (uid 1000)
cf74fa9 verified
Raw
History Blame Contribute Delete
1.22 kB
# ── NEXUS AI β€” Hugging Face Spaces Dockerfile ──────────────────────────────
FROM node:20 AS builder
WORKDIR /app
# Copy package.json and install all dependencies
COPY nexus/package.json ./
RUN npm install
# Copy source code
COPY nexus/ ./
# Build frontend (Vite β†’ dist/public) + backend (esbuild β†’ dist/index.cjs)
RUN npm run build
# ── Production stage ──────────────────────────────────────────────────────────
FROM node:20-slim
# better-sqlite3 needs native build tools
RUN apt-get update && apt-get install -y --no-install-recommends \
python3 make g++ \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy package.json and install production deps only
COPY nexus/package.json ./
RUN npm install --omit=dev
# Copy built artifacts from builder
COPY --from=builder /app/dist ./dist
# node:20-slim already has user 'node' with uid 1000 (required by HF Spaces)
RUN chown -R node:node /app
USER node
# HF Spaces exposes port 7860
ENV PORT=7860
ENV NODE_ENV=production
EXPOSE 7860
CMD ["node", "dist/index.cjs"]