Spaces:
Paused
Paused
Update Dockerfile
Browse files- 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 |
-
#
|
| 14 |
-
|
| 15 |
-
USER user
|
| 16 |
-
ENV PATH="/home/user/.local/bin:$PATH"
|
| 17 |
|
| 18 |
-
#
|
| 19 |
RUN rm -rf /usr/share/nginx/html/*
|
| 20 |
|
| 21 |
-
#
|
| 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;"]
|