nielsr HF staff commited on
Commit
29c2130
·
1 Parent(s): 8545d49
Files changed (1) hide show
  1. Dockerfile +4 -30
Dockerfile CHANGED
@@ -16,37 +16,11 @@ COPY . .
16
  # Build the app
17
  RUN npm run build
18
 
19
- # Production stage
20
- FROM nginx:alpine
21
-
22
- # Create nginx cache directories and set permissions
23
- RUN mkdir -p /var/cache/nginx \
24
- && chown -R nginx:nginx /var/cache/nginx \
25
- && mkdir -p /var/log/nginx \
26
- && chown -R nginx:nginx /var/log/nginx \
27
- && mkdir -p /var/lib/nginx \
28
- && chown -R nginx:nginx /var/lib/nginx \
29
- && touch /var/run/nginx.pid \
30
- && chown -R nginx:nginx /var/run/nginx.pid \
31
- && chown -R nginx:nginx /etc/nginx
32
-
33
- # Copy built assets from builder stage
34
- COPY --from=builder /app/dist /usr/share/nginx/html
35
-
36
- # Copy nginx configuration
37
- COPY nginx.conf /etc/nginx/conf.d/default.conf
38
-
39
- # Update nginx configuration to run as non-root
40
- RUN sed -i '/user nginx;/d' /etc/nginx/nginx.conf \
41
- && sed -i 's,listen 80;,listen 7860;,' /etc/nginx/conf.d/default.conf \
42
- && sed -i '/user/d' /etc/nginx/nginx.conf \
43
- && chown -R nginx:nginx /usr/share/nginx/html
44
-
45
- # Switch to non-root user
46
- USER nginx
47
 
48
  # Expose port 7860 (default for Hugging Face Spaces)
49
  EXPOSE 7860
50
 
51
- # Start nginx
52
- CMD ["nginx", "-g", "daemon off;"]
 
16
  # Build the app
17
  RUN npm run build
18
 
19
+ # Install serve
20
+ RUN npm install -g serve
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
 
22
  # Expose port 7860 (default for Hugging Face Spaces)
23
  EXPOSE 7860
24
 
25
+ # Start server
26
+ CMD ["serve", "-s", "dist", "-l", "7860"]