File size: 1,641 Bytes
2888a5b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2bf9711
32a9e13
2888a5b
 
cb666c5
177c7a4
d0d946a
fe53290
cb666c5
 
0b6faa3
21e9c94
 
 
a5a3006
21e9c94
a5a3006
 
7769088
 
bb7e4dc
2888a5b
 
 
 
 
 
7769088
bb7e4dc
f95abd8
2888a5b
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# FROM node:23.7.0 as builder

# # Install git
# RUN apt-get update && apt-get install -y git

# # Clone the GitHub repository (if not already cloned)
# RUN rm -rf /usr/src/app && git clone https://github.com/abubasith456/Node-WLA.git /usr/src/app

# # Set the working directory
# WORKDIR /usr/src/app

# # Change ownership of the directory to the current user (node)
# RUN chown -R node:node /usr/src/app

# # Mark the repository directory as safe
# USER node
# RUN git config --global --add safe.directory /usr/src/app

# # Install npm dependencies
# RUN npm install

# # Expose the port your application runs on
# EXPOSE 5000

# # Ensure that the latest code is pulled before starting the app
# CMD git pull origin main && npm install && npm start


FROM node:23.7.0 as builder

# Install required dependencies (git & bash)
RUN apt-get update && apt-get install -y git bash

# Clone the GitHub repository (if not already cloned)
RUN rm -rf /usr/src/app && git clone https://github.com/abubasith456/Node-WLA.git /usr/src/app

# Set the working directory
WORKDIR /usr/src/app

# Change ownership of the directory to the current user (node)
RUN chown -R node:node /usr/src/app

# Mark the repository directory as safe
USER node
RUN git config --global --add safe.directory /usr/src/app

# Install npm dependencies
RUN npm install

# Copy start_docker.sh script into the container
COPY start_docker.sh /usr/src/app/start_docker.sh

# Give execution permission
RUN chmod +x /usr/src/app/start_docker.sh

# Expose the port your application runs on
EXPOSE 5000

# Run the start_docker.sh script
CMD ["/bin/bash", "/usr/src/app/start_docker.sh"]