bradduy commited on
Commit
66afcc2
·
1 Parent(s): cad58f1

update readme

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -7
Dockerfile CHANGED
@@ -1,16 +1,24 @@
1
- # Use an official Node.js runtime as a parent image
2
  FROM node:20
3
 
4
- # Set the working directory in the container
5
  WORKDIR /app
6
 
7
- COPY package*.json ./
8
-
9
- # Install dependencies
10
  RUN yarn install
11
 
12
- # Copy the rest of the application code into the container
13
- # COPY . .
 
 
 
 
 
 
 
 
 
14
 
15
  # Expose the port that Next.js will run on
16
  EXPOSE 3000
 
1
+ # Use an official Node.js image
2
  FROM node:20
3
 
4
+ # Create and set the working directory
5
  WORKDIR /app
6
 
7
+ # Copy package.json and install dependencies
8
+ COPY package.json package-lock.json ./
 
9
  RUN yarn install
10
 
11
+ # Add a non-root user (e.g., 'appuser')
12
+ RUN useradd -m appuser
13
+
14
+ # Give ownership of the app directory to the new user
15
+ RUN chown -R appuser /app
16
+
17
+ # Switch to the non-root user
18
+ USER appuser
19
+
20
+ # Copy the rest of the application code
21
+ COPY . .
22
 
23
  # Expose the port that Next.js will run on
24
  EXPOSE 3000