File size: 1,497 Bytes
1137e8f
b22e895
 
 
 
 
 
 
 
 
 
 
 
 
 
 
170d092
b22e895
 
 
170d092
b22e895
 
 
 
 
 
 
 
 
 
 
170d092
b22e895
 
 
 
 
 
 
 
 
 
 
 
80914d1
 
170d092
 
1137e8f
 
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
42
43
44
45
46
47
48
49
50
51
52
ARG CACHE_BUST=1
# ---- Stage 1: Build ----
FROM node:20-alpine AS builder
WORKDIR /app

# Vite bakes VITE_* vars in at BUILD time — pass them as build args
# (see docker-compose.yml). Empty values keep the demo fallback UI.
ARG VITE_SUPABASE_URL=""
ARG VITE_SUPABASE_ANON_KEY=""
ARG VITE_API_URL=""
ENV VITE_SUPABASE_URL=$VITE_SUPABASE_URL \
    VITE_SUPABASE_ANON_KEY=$VITE_SUPABASE_ANON_KEY \
    VITE_API_URL=$VITE_API_URL

# Install dependencies first (layer caching)
COPY package.json ./
RUN npm install --prefer-offline --no-audit --no-fund --no-cache

# Copy source and build frontend + bundle server
COPY . .
RUN npm run build --if-present

# ---- Stage 2: Production ----
FROM node:20-alpine AS production
WORKDIR /app

# HF Spaces routes to 7860 — the server MUST default to it (see server.ts).
ENV NODE_ENV=production \
    PORT=7860

# Install production-only dependencies (esbuild, vitest, typescript etc. excluded)
COPY package.json ./
RUN npm install --prefer-offline --no-audit --no-fund --no-cache --omit=dev && npm cache clean --force

# Copy the built output from builder stage
COPY --from=builder /app/dist ./dist

EXPOSE 7860

HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \

  CMD wget -qO- http://127.0.0.1:7860/api/health >/dev/null 2>&1 || exit 1

CMD ["node", "dist/server.cjs"]

# FORCE REBUILD 1789683005

# FORCE REBUILD 1789683498

# FORCE REBUILD 1789684080

# FORCE REBUILD 1789684846