dinzymari commited on
Commit
e57692a
·
verified ·
1 Parent(s): 65c391b

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +25 -15
Dockerfile CHANGED
@@ -1,5 +1,5 @@
1
  # Use Node.js LTS (Buster) as the base image
2
- FROM node:18
3
 
4
  # Install FFmpeg, ImageMagick, and other essential tools
5
  RUN apt-get update && \
@@ -14,28 +14,38 @@ RUN apt-get update && \
14
  && apt-get clean \
15
  && rm -rf /var/lib/apt/lists/*
16
 
17
- # Set working directory and grant ownership to 'node' user
18
- WORKDIR /home/suhail
 
19
  RUN git clone https://github.com/hakimi709/theboss /home/suhail
20
- RUN chown -R node:node /home/suhail
21
 
22
- # Switch to the 'node' user for all subsequent steps
23
- USER node
24
 
25
- # Install dependencies using yarn
26
- RUN yarn install --frozen-lockfile
 
 
 
 
 
 
27
 
28
- # Copy additional files and set permissions
29
- COPY server.js /home/suhail
30
  COPY config.env /home/suhail
31
- RUN chmod 600 /home/suhail/config.env
32
 
33
- # Create and make the start script executable
 
 
 
 
 
34
  RUN echo '#!/bin/sh\nnode server.js &\nnpm start' > start.sh
 
 
35
  RUN chmod +x start.sh
36
 
37
- # Expose the desired port
38
  EXPOSE 7860
39
 
40
- # Define the startup command
41
- CMD ["./start.sh"]
 
1
  # Use Node.js LTS (Buster) as the base image
2
+ FROM node:latest
3
 
4
  # Install FFmpeg, ImageMagick, and other essential tools
5
  RUN apt-get update && \
 
14
  && apt-get clean \
15
  && rm -rf /var/lib/apt/lists/*
16
 
17
+ USER node
18
+
19
+ # Clone the repository
20
  RUN git clone https://github.com/hakimi709/theboss /home/suhail
 
21
 
22
+ # Set the working directory
23
+ WORKDIR /home/suhail
24
 
25
+ # Grant full permissions to the directory (this step should help if there are permission issues)
26
+ RUN chmod -R 777 /home/suhail
27
+
28
+ # Change ownership of the directory to the 'node' user
29
+ RUN chown -R node:node /home/suhail
30
+
31
+ # Copy the server.js file into the working directory
32
+ COPY server.js .
33
 
 
 
34
  COPY config.env /home/suhail
 
35
 
36
+ RUN chmod 777 /home/suhail/config.env
37
+
38
+ # Install dependencies (try npm first, fall back to yarn)
39
+ RUN yarn install
40
+
41
+ # Create the start.sh script directly
42
  RUN echo '#!/bin/sh\nnode server.js &\nnpm start' > start.sh
43
+
44
+ # Make the start.sh script executable
45
  RUN chmod +x start.sh
46
 
47
+ # Expose the port
48
  EXPOSE 7860
49
 
50
+ # Run the start.sh script
51
+ CMD ./start.sh