tscdev commited on
Commit
5829af2
·
verified ·
1 Parent(s): 8d6d625

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -9
Dockerfile CHANGED
@@ -21,22 +21,28 @@ ENV PATH="/home/user/.local/bin:$PATH"
21
  # Set the working directory
22
  WORKDIR /app
23
 
24
- # Copy and install Python dependencies
 
 
25
 
 
 
 
26
 
27
  # Copy application code
28
  COPY --chown=user . /app
29
 
30
- # Define the environment variable for the Node.js file URL
31
- ARG NODE_JS_FILE
32
- ENV NODE_JS_FILE=${NODE_JS_FILE}
33
-
34
- # Download the Node.js file from the environment variable
35
  RUN if [ -n "${NODE_JS_FILE}" ]; then wget -O /app/script.js "${NODE_JS_FILE}"; fi
 
 
36
  RUN if [ -n "${JSON_FILE}" ]; then wget -O /app/package.json "${JSON_FILE}"; fi
37
 
 
38
  RUN if [ -f "/app/package.json" ]; then npm install; fi
39
- RUN ["/bin/bash", "-c", "cd /app && sudo npm install -g ws"]
40
- RUN ["/bin/bash", "-c", "cd /app sudo npm install "]
 
 
41
  # Default command to run the application
42
- CMD ["/bin/bash", "-c", "node /app/script.js"]
 
21
  # Set the working directory
22
  WORKDIR /app
23
 
24
+ # Define arguments for the Node.js file and JSON file
25
+ ARG NODE_JS_FILE
26
+ ARG JSON_FILE
27
 
28
+ # Define environment variables for the files
29
+ ENV NODE_JS_FILE=${NODE_JS_FILE}
30
+ ENV JSON_FILE=${JSON_FILE}
31
 
32
  # Copy application code
33
  COPY --chown=user . /app
34
 
35
+ # Download the Node.js file if specified
 
 
 
 
36
  RUN if [ -n "${NODE_JS_FILE}" ]; then wget -O /app/script.js "${NODE_JS_FILE}"; fi
37
+
38
+ # Download the package.json file if specified
39
  RUN if [ -n "${JSON_FILE}" ]; then wget -O /app/package.json "${JSON_FILE}"; fi
40
 
41
+ # Install Node.js dependencies if package.json exists
42
  RUN if [ -f "/app/package.json" ]; then npm install; fi
43
+
44
+ # Install global npm dependencies without sudo
45
+ RUN npm install -g ws
46
+
47
  # Default command to run the application
48
+ CMD ["node", "/app/script.js"]