ZuhairAhmed commited on
Commit
e79ea64
·
1 Parent(s): 3a34666

docker update

Browse files
Files changed (1) hide show
  1. Dockerfile +14 -2
Dockerfile CHANGED
@@ -1,18 +1,30 @@
 
1
  FROM node:18-alpine
2
 
 
3
  WORKDIR /usr/src/app
4
 
 
5
  COPY package.json package-lock.json .npmrc ./
6
-
7
  RUN npm install
8
 
 
9
  COPY . .
10
 
 
11
  RUN mkdir -p /usr/src/app/src/components/generated && \
12
- chmod -R 755 /usr/src/app/src/components/generated
 
 
 
 
 
13
 
 
14
  EXPOSE 3000
15
 
 
16
  ENV NODE_ENV=development
17
 
 
18
  CMD ["npm", "run", "dev"]
 
1
+ # Use Node.js 18 on Alpine Linux
2
  FROM node:18-alpine
3
 
4
+ # Set the working directory in the container
5
  WORKDIR /usr/src/app
6
 
7
+ # Copy package files and install dependencies
8
  COPY package.json package-lock.json .npmrc ./
 
9
  RUN npm install
10
 
11
+ # Copy the rest of the application code
12
  COPY . .
13
 
14
+ # Create the generated directory and ensure proper permissions
15
  RUN mkdir -p /usr/src/app/src/components/generated && \
16
+ chmod -R 755 /usr/src/app
17
+
18
+ # Create a non-root user and switch to it
19
+ RUN adduser -D appuser && \
20
+ chown -R appuser:appuser /usr/src/app
21
+ USER appuser
22
 
23
+ # Expose the application port
24
  EXPOSE 3000
25
 
26
+ # Set environment variables
27
  ENV NODE_ENV=development
28
 
29
+ # Run the application in development mode
30
  CMD ["npm", "run", "dev"]