Álvaro Valenzuela Valdes commited on
Commit ·
bf5c9dd
1
Parent(s): 0606c35
🚀 Fix: Dockerfile user conflict (using node user)
Browse files- frontend/Dockerfile +6 -9
frontend/Dockerfile
CHANGED
|
@@ -18,24 +18,21 @@ RUN npm run build
|
|
| 18 |
# Production stage
|
| 19 |
FROM node:18-alpine
|
| 20 |
|
| 21 |
-
# Create app user (required for HF Spaces security)
|
| 22 |
-
RUN addgroup -g 1000 user && adduser -u 1000 -G user -s /bin/sh -D user
|
| 23 |
-
|
| 24 |
WORKDIR /app
|
| 25 |
|
| 26 |
# Copy built application from builder
|
| 27 |
-
COPY --from=builder --chown=
|
| 28 |
-
COPY --from=builder --chown=
|
| 29 |
-
COPY --from=builder --chown=
|
| 30 |
-
COPY --from=builder --chown=
|
| 31 |
-
COPY --from=builder --chown=
|
| 32 |
|
| 33 |
# Set environment
|
| 34 |
ENV NODE_ENV=production \
|
| 35 |
NEXT_TELEMETRY_DISABLED=1
|
| 36 |
|
| 37 |
# Switch to non-root user
|
| 38 |
-
USER
|
| 39 |
|
| 40 |
# Health check
|
| 41 |
HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \
|
|
|
|
| 18 |
# Production stage
|
| 19 |
FROM node:18-alpine
|
| 20 |
|
|
|
|
|
|
|
|
|
|
| 21 |
WORKDIR /app
|
| 22 |
|
| 23 |
# Copy built application from builder
|
| 24 |
+
COPY --from=builder --chown=node:node /app/.next ./.next
|
| 25 |
+
COPY --from=builder --chown=node:node /app/public ./public
|
| 26 |
+
COPY --from=builder --chown=node:node /app/node_modules ./node_modules
|
| 27 |
+
COPY --from=builder --chown=node:node /app/package*.json ./
|
| 28 |
+
COPY --from=builder --chown=node:node /app/next.config.js ./
|
| 29 |
|
| 30 |
# Set environment
|
| 31 |
ENV NODE_ENV=production \
|
| 32 |
NEXT_TELEMETRY_DISABLED=1
|
| 33 |
|
| 34 |
# Switch to non-root user
|
| 35 |
+
USER node
|
| 36 |
|
| 37 |
# Health check
|
| 38 |
HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \
|