Spaces:
Sleeping
Sleeping
Commit
·
1a257e4
1
Parent(s):
5dc07e6
add: huggingface docker
Browse files- Dockerfile +24 -10
Dockerfile
CHANGED
@@ -1,17 +1,14 @@
|
|
1 |
-
#
|
2 |
-
FROM node:22-alpine
|
3 |
|
4 |
# Set working directory
|
5 |
WORKDIR /app
|
6 |
|
7 |
-
# Set NODE_ENV to production
|
8 |
-
ENV NODE_ENV=production
|
9 |
-
|
10 |
# Copy package files
|
11 |
COPY package*.json ./
|
12 |
|
13 |
-
# Install all dependencies (including
|
14 |
-
RUN npm ci
|
15 |
|
16 |
# Copy source code
|
17 |
COPY . .
|
@@ -19,12 +16,29 @@ COPY . .
|
|
19 |
# Build the application
|
20 |
RUN npm run build
|
21 |
|
22 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
# Expose port 7860 (required by Hugging Face Spaces)
|
25 |
EXPOSE 7860
|
26 |
|
27 |
-
# Health check removed for HF Spaces compatibility
|
28 |
-
|
29 |
# Start the application
|
30 |
CMD ["npm", "start"]
|
|
|
1 |
+
# Build stage
|
2 |
+
FROM node:22-alpine AS builder
|
3 |
|
4 |
# Set working directory
|
5 |
WORKDIR /app
|
6 |
|
|
|
|
|
|
|
7 |
# Copy package files
|
8 |
COPY package*.json ./
|
9 |
|
10 |
+
# Install all dependencies (including devDependencies for building)
|
11 |
+
RUN npm ci
|
12 |
|
13 |
# Copy source code
|
14 |
COPY . .
|
|
|
16 |
# Build the application
|
17 |
RUN npm run build
|
18 |
|
19 |
+
# Production stage
|
20 |
+
FROM node:22-alpine AS production
|
21 |
+
|
22 |
+
# Set NODE_ENV to production
|
23 |
+
ENV NODE_ENV=production
|
24 |
+
|
25 |
+
# Set working directory
|
26 |
+
WORKDIR /app
|
27 |
+
|
28 |
+
# Copy package files
|
29 |
+
COPY package*.json ./
|
30 |
+
|
31 |
+
# Install only production dependencies
|
32 |
+
RUN npm ci --omit=dev && npm cache clean --force
|
33 |
+
|
34 |
+
# Copy built application from builder stage
|
35 |
+
COPY --from=builder /app/dist ./dist
|
36 |
+
|
37 |
+
# Copy server file
|
38 |
+
COPY server.js ./
|
39 |
|
40 |
# Expose port 7860 (required by Hugging Face Spaces)
|
41 |
EXPOSE 7860
|
42 |
|
|
|
|
|
43 |
# Start the application
|
44 |
CMD ["npm", "start"]
|