Trần Viết Sơn commited on
Commit
2f7b603
1 Parent(s): 8526a4e

fix: update docker file

Browse files
Files changed (3) hide show
  1. Dockerfile +27 -0
  2. README.md +1 -0
  3. backend/Dockerfile +3 -3
Dockerfile ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use an official Node.js runtime as a parent image
2
+ FROM node:22-alpine
3
+
4
+ # Set the working directory
5
+ WORKDIR /app
6
+
7
+ # Copy package.json and package-lock.json
8
+ COPY backend/package*.json ./
9
+
10
+ # Install dependencies
11
+ RUN npm install
12
+
13
+ # Copy the rest of the application code
14
+ COPY backend/ .
15
+
16
+ # Build the application
17
+ RUN npm run build
18
+
19
+
20
+ COPY backend/entrypoint.sh ./entrypoint.sh
21
+
22
+ # Expose the port that the app will run on
23
+ EXPOSE 3000
24
+
25
+ # Command to run the application
26
+ ENTRYPOINT ["./entrypoint.sh"]
27
+ CMD ["npm", "run", "start:prod"]
README.md CHANGED
@@ -5,6 +5,7 @@ colorFrom: gray
5
  colorTo: gray
6
  sdk: docker
7
  pinned: false
 
8
  ---
9
 
10
  # PBL6 Information System
 
5
  colorTo: gray
6
  sdk: docker
7
  pinned: false
8
+ app_port: 3000
9
  ---
10
 
11
  # PBL6 Information System
backend/Dockerfile CHANGED
@@ -5,19 +5,19 @@ FROM node:22-alpine
5
  WORKDIR /app
6
 
7
  # Copy package.json and package-lock.json
8
- COPY package*.json ./
9
 
10
  # Install dependencies
11
  RUN npm install
12
 
13
  # Copy the rest of the application code
14
- COPY . .
15
 
16
  # Build the application
17
  RUN npm run build
18
 
19
 
20
- COPY entrypoint.sh ./entrypoint.sh
21
 
22
  # Expose the port that the app will run on
23
  EXPOSE 3000
 
5
  WORKDIR /app
6
 
7
  # Copy package.json and package-lock.json
8
+ COPY backend/package*.json ./
9
 
10
  # Install dependencies
11
  RUN npm install
12
 
13
  # Copy the rest of the application code
14
+ COPY backend/ .
15
 
16
  # Build the application
17
  RUN npm run build
18
 
19
 
20
+ COPY backend/entrypoint.sh ./entrypoint.sh
21
 
22
  # Expose the port that the app will run on
23
  EXPOSE 3000