2nzi commited on
Commit
884678f
·
verified ·
1 Parent(s): 713f150
Files changed (1) hide show
  1. Dockerfile +28 -17
Dockerfile CHANGED
@@ -1,17 +1,28 @@
1
- # Dockerfile - Pour Hugging Face Spaces
2
- FROM node:22.14.0-alpine AS build-stage
3
-
4
- WORKDIR /app
5
- COPY package*.json ./
6
- RUN npm ci --only=production=false
7
- COPY . .
8
- RUN npm run build
9
-
10
- FROM nginx:alpine AS production-stage
11
- COPY --from=build-stage /app/dist /usr/share/nginx/html
12
-
13
- # Configuration minimale pour SPA
14
- RUN echo 'server { listen 7860; location / { root /usr/share/nginx/html; try_files $uri $uri/ /index.html; } }' > /etc/nginx/conf.d/default.conf
15
-
16
- EXPOSE 7860
17
- CMD ["nginx", "-g", "daemon off;"]
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Dockerfile - Version simplifiée avec serve
2
+ FROM node:22.14.0-alpine AS build-stage
3
+
4
+ WORKDIR /app
5
+ COPY package*.json ./
6
+ RUN npm ci --only=production=false
7
+ COPY . .
8
+ RUN npm run build
9
+
10
+ FROM node:22.14.0-alpine AS production-stage
11
+
12
+ # Créer l'utilisateur requis par Hugging Face
13
+ RUN adduser -D -s /bin/sh -u 1000 user
14
+
15
+ # Installer serve globalement
16
+ RUN npm install -g serve
17
+
18
+ # Passer à l'utilisateur non-root
19
+ USER user
20
+
21
+ # Copier les fichiers buildés
22
+ WORKDIR /home/user
23
+ COPY --chown=user:user --from=build-stage /app/dist ./dist
24
+
25
+ EXPOSE 7860
26
+
27
+ # Utiliser serve au lieu de nginx
28
+ CMD ["serve", "-s", "dist", "-l", "7860"]