sitcod3 commited on
Commit
b22e895
·
verified ·
1 Parent(s): c771c5f

Upload Dockerfile with huggingface_hub

Browse files
Files changed (1) hide show
  1. Dockerfile +44 -42
Dockerfile CHANGED
@@ -1,42 +1,44 @@
1
- # ---- Stage 1: Build ----
2
- FROM node:20-alpine AS builder
3
- WORKDIR /app
4
-
5
- # Vite bakes VITE_* vars in at BUILD time — pass them as build args
6
- # (see docker-compose.yml). Empty values keep the demo fallback UI.
7
- ARG VITE_SUPABASE_URL=""
8
- ARG VITE_SUPABASE_ANON_KEY=""
9
- ARG VITE_API_URL=""
10
- ENV VITE_SUPABASE_URL=$VITE_SUPABASE_URL \
11
- VITE_SUPABASE_ANON_KEY=$VITE_SUPABASE_ANON_KEY \
12
- VITE_API_URL=$VITE_API_URL
13
-
14
- # Install dependencies first (layer caching)
15
- COPY package.json ./
16
- RUN npm install
17
-
18
- # Copy source and build frontend + bundle server
19
- COPY . .
20
- RUN npm run build
21
-
22
- # ---- Stage 2: Production ----
23
- FROM node:20-alpine AS production
24
- WORKDIR /app
25
-
26
- # HF Spaces routes to 7860 — the server MUST default to it (see server.ts).
27
- ENV NODE_ENV=production \
28
- PORT=7860
29
-
30
- # Install production-only dependencies (esbuild, vitest, typescript etc. excluded)
31
- COPY package.json ./
32
- RUN npm install --omit=dev && npm cache clean --force
33
-
34
- # Copy the built output from builder stage
35
- COPY --from=builder /app/dist ./dist
36
-
37
- EXPOSE 7860
38
-
39
- HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
40
- CMD wget -qO- http://127.0.0.1:7860/api/health >/dev/null 2>&1 || exit 1
41
-
42
- CMD ["node", "dist/server.cjs"]
 
 
 
1
+ # ---- Stage 1: Build ----
2
+ FROM node:20-alpine AS builder
3
+ WORKDIR /app
4
+
5
+ # Vite bakes VITE_* vars in at BUILD time — pass them as build args
6
+ # (see docker-compose.yml). Empty values keep the demo fallback UI.
7
+ ARG VITE_SUPABASE_URL=""
8
+ ARG VITE_SUPABASE_ANON_KEY=""
9
+ ARG VITE_API_URL=""
10
+ ENV VITE_SUPABASE_URL=$VITE_SUPABASE_URL \
11
+ VITE_SUPABASE_ANON_KEY=$VITE_SUPABASE_ANON_KEY \
12
+ VITE_API_URL=$VITE_API_URL
13
+
14
+ # Install dependencies first (layer caching)
15
+ COPY package.json ./
16
+ RUN npm install
17
+
18
+ # Copy source and build frontend + bundle server
19
+ COPY . .
20
+ RUN npm run build
21
+
22
+ # ---- Stage 2: Production ----
23
+ FROM node:20-alpine AS production
24
+ WORKDIR /app
25
+
26
+ # HF Spaces routes to 7860 — the server MUST default to it (see server.ts).
27
+ ENV NODE_ENV=production \
28
+ PORT=7860
29
+
30
+ # Install production-only dependencies (esbuild, vitest, typescript etc. excluded)
31
+ COPY package.json ./
32
+ RUN npm install --omit=dev && npm cache clean --force
33
+
34
+ # Copy the built output from builder stage
35
+ COPY --from=builder /app/dist ./dist
36
+
37
+ EXPOSE 7860
38
+
39
+ HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
40
+ CMD wget -qO- http://127.0.0.1:7860/api/health >/dev/null 2>&1 || exit 1
41
+
42
+ CMD ["node", "dist/server.cjs"]
43
+
44
+ # FORCE REBUILD 1789683005