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

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +8 -15
Dockerfile CHANGED
@@ -1,27 +1,20 @@
1
  FROM node:18-alpine
2
 
3
- # Create app directory with proper ownership
4
  WORKDIR /app
5
 
6
- # Create a non-root user
7
- RUN addgroup -g 1001 -S nodejs
8
- RUN adduser -S nextjs -u 1001
9
 
10
- # Copy package files
11
- COPY package*.json ./
12
-
13
- # Install dependencies
14
  RUN npm install
15
 
16
- # Copy source code and change ownership
17
- COPY . .
18
- RUN chown -R nextjs:nodejs /app
19
 
20
- # Switch to non-root user
21
  USER nextjs
22
 
23
- # Expose port
24
  EXPOSE 7860
25
-
26
- # Start the development server
27
  CMD ["npm", "run", "dev"]
 
1
  FROM node:18-alpine
2
 
3
+ # Create app directory
4
  WORKDIR /app
5
 
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"]