Niansuh commited on
Commit
e5c36fd
1 Parent(s): a91591e

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +36 -0
Dockerfile ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM node:lts AS BUILD_IMAGE
2
+
3
+ # Update the package list and install git
4
+ 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/Niansuh/DS2A.git /app
10
+
11
+ # Install dependencies and build the project
12
+ RUN yarn install --registry https://registry.npmmirror.com/ && yarn run build
13
+
14
+ FROM node:lts-alpine
15
+
16
+ # Copy build output, package.json and public directory from build stage
17
+ COPY --from=BUILD_IMAGE /app/dist /app/dist
18
+ COPY --from=BUILD_IMAGE /app/package.json /app/package.json
19
+ COPY --from=BUILD_IMAGE /app/public /app/public
20
+
21
+ WORKDIR /app
22
+
23
+ # Install production dependencies
24
+ RUN yarn install --production --registry https://registry.npmmirror.com/
25
+
26
+ # Create the log directory and grant write permissions
27
+ RUN mkdir -p /app/logs && chmod 777 /app/logs
28
+
29
+ # Specify port environment variable
30
+ ENV PORT 7860
31
+
32
+ # Expose port
33
+ EXPOSE $PORT
34
+
35
+ # Specify the command to be executed when the container starts
36
+ CMD ["node", "dist/index.js", "--port", "7860"]