File size: 1,257 Bytes
bea55e2
3f4c55d
 
bea55e2
862389f
94c9882
 
862389f
 
 
3f4c55d
 
862389f
3f4c55d
 
bea55e2
3f4c55d
bea55e2
862389f
 
3f4c55d
94c9882
 
 
 
 
 
 
 
 
bea55e2
 
94c9882
3f4c55d
94c9882
 
 
862389f
bea55e2
94c9882
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
40
41
# Cellex — Render / HF Space Deployment
# Multi-stage build: Node 20 alpine builder + slim runner.
# Uses npm ci for deterministic, cacheable installs.
# Serves Next.js standalone — PORT is set by Render automatically.

# ---- Stage 1: Build ----
FROM node:20-alpine AS builder

WORKDIR /app

# Copy lockfiles first so this layer is cached unless deps change.
COPY package.json package-lock.json ./

# Use npm ci for reproducible installs (requires package-lock.json).
# --legacy-peer-deps avoids peer-dep conflicts with Next 16.
RUN npm install --no-audit --no-fund --legacy-peer-deps

# Now copy the rest of the source.
COPY . .

# Build the Next.js standalone output (also copies static + public into standalone)
RUN npm run build

# ---- Stage 2: Run ----
FROM node:20-alpine AS runner

WORKDIR /app

ENV NODE_ENV=production
ENV HOSTNAME=0.0.0.0
# PORT is set by Render (defaults to 10000). Don't hardcode it here
# so the same Dockerfile works on both Render and HF Spaces.

# Copy standalone build + static assets + public
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static
COPY --from=builder /app/public ./public

# Run the standalone Next.js server (reads PORT from env)
CMD ["node", "server.js"]