Aynkhn commited on
Commit
5874a8b
·
1 Parent(s): d6a24c7

Fix docker user uid conflict

Browse files
Files changed (1) hide show
  1. Dockerfile +5 -5
Dockerfile CHANGED
@@ -28,16 +28,16 @@ WORKDIR /app
28
  ENV NODE_ENV=production
29
  ENV NEXT_TELEMETRY_DISABLED=1
30
 
31
- # Hugging Face runs containers as a non-root user (uid 1000)
32
- RUN adduser --system --uid 1000 nextjs
33
 
34
  COPY --from=builder /app/public ./public
35
 
36
  # Automatically leverage output traces to reduce image size
37
- COPY --from=builder --chown=nextjs:root /app/.next/standalone ./
38
- COPY --from=builder --chown=nextjs:root /app/.next/static ./.next/static
39
 
40
- USER nextjs
41
 
42
  # Hugging Face routes traffic to port 7860
43
  EXPOSE 7860
 
28
  ENV NODE_ENV=production
29
  ENV NEXT_TELEMETRY_DISABLED=1
30
 
31
+ # The node:alpine image already has a built-in 'node' user with uid 1000
32
+ # which is perfect for Hugging Face Spaces!
33
 
34
  COPY --from=builder /app/public ./public
35
 
36
  # Automatically leverage output traces to reduce image size
37
+ COPY --from=builder --chown=node:root /app/.next/standalone ./
38
+ COPY --from=builder --chown=node:root /app/.next/static ./.next/static
39
 
40
+ USER node
41
 
42
  # Hugging Face routes traffic to port 7860
43
  EXPOSE 7860