sanch1tx commited on
Commit
0bc33d2
·
verified ·
1 Parent(s): 2fc4001

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -6
Dockerfile CHANGED
@@ -10,19 +10,24 @@ RUN npm run build
10
  # Stage 2: Serve with Nginx
11
  FROM nginx:alpine
12
 
13
- # Create a non-root user with UID 1000 (for Hugging Face compatibility)
14
- RUN adduser -D -u 1000 user
15
- USER user
16
- ENV PATH="/home/user/.local/bin:$PATH"
17
 
18
- # Clean default html files
19
  RUN rm -rf /usr/share/nginx/html/*
20
 
21
- # Use a custom nginx.conf that avoids /run/nginx.pid and /etc/nginx/conf.d
22
  COPY nginx.conf /etc/nginx/nginx.conf
23
 
24
  # Copy built frontend from builder
25
  COPY --from=builder /app/dist /usr/share/nginx/html
26
 
 
 
 
 
 
 
 
27
  EXPOSE 7860
28
  CMD ["nginx", "-g", "daemon off;"]
 
10
  # Stage 2: Serve with Nginx
11
  FROM nginx:alpine
12
 
13
+ # Set working directory
14
+ WORKDIR /app
 
 
15
 
16
+ # Remove default nginx files as root
17
  RUN rm -rf /usr/share/nginx/html/*
18
 
19
+ # Copy custom nginx config (must not include pid or user directive)
20
  COPY nginx.conf /etc/nginx/nginx.conf
21
 
22
  # Copy built frontend from builder
23
  COPY --from=builder /app/dist /usr/share/nginx/html
24
 
25
+ # Create user AFTER copying and cleanup
26
+ RUN adduser -D -u 1000 user
27
+
28
+ # Switch to non-root user
29
+ USER user
30
+ ENV PATH="/home/user/.local/bin:$PATH"
31
+
32
  EXPOSE 7860
33
  CMD ["nginx", "-g", "daemon off;"]