ColamanAI commited on
Commit
1fa0b56
·
verified ·
1 Parent(s): ee4731f

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -8
Dockerfile CHANGED
@@ -1,3 +1,4 @@
 
1
  FROM node:lts AS BUILD_IMAGE
2
 
3
  # Update the package list and install git
@@ -5,20 +6,23 @@ RUN apt-get update && apt-get install -y git
5
 
6
  WORKDIR /app
7
 
8
- # Pull GitHub repository
9
  RUN git clone https://github.com/LLM-Red-Team/glm-free-api.git /app
10
 
 
11
  RUN yarn install --registry https://registry.npmmirror.com/ && yarn run build
12
 
 
13
  FROM node:lts-alpine
14
 
 
15
 
16
- # Copy the built files and required directories
17
- COPY --from=build /app/configs /app/configs
18
- COPY --from=build /app/package.json /app/package.json
19
- COPY --from=build /app/dist /app/dist
20
- COPY --from=build /app/public /app/public
21
- COPY --from=build /app/node_modules /app/node_modules
22
 
23
  # Install production dependencies
24
  RUN yarn install --production --registry https://registry.npmmirror.com/
@@ -30,4 +34,4 @@ RUN mkdir -p /app/logs && chmod 777 /app/logs
30
  EXPOSE 8000
31
 
32
  # Command to run your app using npm
33
- CMD ["npm", "start"]
 
1
+ # First stage: build environment
2
  FROM node:lts AS BUILD_IMAGE
3
 
4
  # Update the package list and install git
 
6
 
7
  WORKDIR /app
8
 
9
+ # Clone GitHub repository
10
  RUN git clone https://github.com/LLM-Red-Team/glm-free-api.git /app
11
 
12
+ # Install dependencies and build the project
13
  RUN yarn install --registry https://registry.npmmirror.com/ && yarn run build
14
 
15
+ # Second stage: production environment
16
  FROM node:lts-alpine
17
 
18
+ WORKDIR /app
19
 
20
+ # Copy the built files and required directories from the build stage
21
+ COPY --from=BUILD_IMAGE /app/configs /app/configs
22
+ COPY --from=BUILD_IMAGE /app/package.json /app/package.json
23
+ COPY --from=BUILD_IMAGE /app/dist /app/dist
24
+ COPY --from=BUILD_IMAGE /app/public /app/public
25
+ COPY --from=BUILD_IMAGE /app/node_modules /app/node_modules
26
 
27
  # Install production dependencies
28
  RUN yarn install --production --registry https://registry.npmmirror.com/
 
34
  EXPOSE 8000
35
 
36
  # Command to run your app using npm
37
+ CMD ["npm", "start"]