Jacksuyu Claude Opus 4.6 commited on
Commit
741ff99
·
1 Parent(s): c9da1f2

Fix Dockerfile: use existing node user (uid 1000)

Browse files

The node:22-slim image already has a 'node' user with uid/gid 1000.
Creating a new group with gid 1000 fails. Use the existing user instead.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Files changed (1) hide show
  1. Dockerfile +7 -8
Dockerfile CHANGED
@@ -1,6 +1,6 @@
1
  FROM node:22-slim AS base
2
 
3
- # Install OpenSSL for Prisma
4
  RUN apt-get update && apt-get install -y openssl python3 make g++ && rm -rf /var/lib/apt/lists/*
5
 
6
  WORKDIR /app
@@ -28,14 +28,13 @@ WORKDIR /app
28
 
29
  ENV NODE_ENV=production
30
 
31
- # HF Spaces runs as uid 1000
32
- RUN addgroup --system --gid 1000 nodejs && \
33
- adduser --system --uid 1000 nextjs
34
 
35
  # Copy necessary files
36
  COPY --from=builder /app/public ./public
37
- COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
38
- COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
39
  COPY --from=builder /app/prisma ./prisma
40
  COPY --from=builder /app/prisma.config.ts ./prisma.config.ts
41
  COPY --from=builder /app/generated ./generated
@@ -44,9 +43,9 @@ COPY --from=builder /app/node_modules/@prisma ./node_modules/@prisma
44
  COPY --from=builder /app/node_modules/better-sqlite3 ./node_modules/better-sqlite3
45
 
46
  # Create data directory for SQLite with correct permissions
47
- RUN mkdir -p /app/data && chown nextjs:nodejs /app/data
48
 
49
- USER nextjs
50
 
51
  # HF Spaces expects port 7860
52
  EXPOSE 7860
 
1
  FROM node:22-slim AS base
2
 
3
+ # Install OpenSSL for Prisma + build tools for native modules
4
  RUN apt-get update && apt-get install -y openssl python3 make g++ && rm -rf /var/lib/apt/lists/*
5
 
6
  WORKDIR /app
 
28
 
29
  ENV NODE_ENV=production
30
 
31
+ # Use the existing 'node' user (uid 1000) that comes with the node image
32
+ # HF Spaces also runs as uid 1000, so this is compatible
 
33
 
34
  # Copy necessary files
35
  COPY --from=builder /app/public ./public
36
+ COPY --from=builder --chown=node:node /app/.next/standalone ./
37
+ COPY --from=builder --chown=node:node /app/.next/static ./.next/static
38
  COPY --from=builder /app/prisma ./prisma
39
  COPY --from=builder /app/prisma.config.ts ./prisma.config.ts
40
  COPY --from=builder /app/generated ./generated
 
43
  COPY --from=builder /app/node_modules/better-sqlite3 ./node_modules/better-sqlite3
44
 
45
  # Create data directory for SQLite with correct permissions
46
+ RUN mkdir -p /app/data && chown node:node /app/data
47
 
48
+ USER node
49
 
50
  # HF Spaces expects port 7860
51
  EXPOSE 7860