no-name-here commited on
Commit
8f5c9dc
·
verified ·
1 Parent(s): 34c9a94

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +8 -5
Dockerfile CHANGED
@@ -6,15 +6,18 @@ WORKDIR /app
6
  # Create non-root user
7
  RUN addgroup -g 1001 -S nodejs && adduser -S nextjs -u 1001
8
 
9
- # Copy files with correct ownership
10
- COPY --chown=nextjs:nodejs package*.json ./
11
  RUN npm install
12
 
13
- COPY --chown=nextjs:nodejs . .
 
14
 
15
- # Use non-root user
 
 
 
16
  USER nextjs
17
 
18
- # Expose and run
19
  EXPOSE 7860
20
  CMD ["npm", "run", "dev"]
 
6
  # Create non-root user
7
  RUN addgroup -g 1001 -S nodejs && adduser -S nextjs -u 1001
8
 
9
+ # Copy files and set ownership
10
+ COPY package*.json ./
11
  RUN npm install
12
 
13
+ # Copy source code as root
14
+ COPY . .
15
 
16
+ # Fix permissions so nextjs user can write to /app
17
+ RUN chown -R nextjs:nodejs /app
18
+
19
+ # Switch to non-root user
20
  USER nextjs
21
 
 
22
  EXPOSE 7860
23
  CMD ["npm", "run", "dev"]