Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +16 -5
Dockerfile
CHANGED
@@ -9,20 +9,31 @@ ENV TOKEN=MTAyOTExOTAzMzEwODM0NDg0Mw.GHRuSg.UJGFPx7vbUBU23sHWzUPastwQXwsi1aWZnKj
|
|
9 |
# Set the working directory
|
10 |
WORKDIR /code
|
11 |
|
12 |
-
#
|
13 |
-
|
|
|
|
|
|
|
14 |
|
15 |
# Change ownership of the files to allow npm install
|
16 |
-
RUN chown -R node:node /code
|
17 |
|
18 |
# Switch to the node user
|
19 |
USER node
|
20 |
|
21 |
-
|
|
|
|
|
|
|
|
|
22 |
|
23 |
-
# Copy the rest of the application code
|
24 |
COPY . .
|
25 |
|
|
|
|
|
|
|
|
|
26 |
# Expose any necessary ports
|
27 |
EXPOSE 7860
|
28 |
|
|
|
9 |
# Set the working directory
|
10 |
WORKDIR /code
|
11 |
|
12 |
+
# Create a temporary directory
|
13 |
+
RUN mkdir /tmp/code
|
14 |
+
|
15 |
+
# Copy package.json and package-lock.json to the temporary directory
|
16 |
+
COPY package*.json /tmp/code/
|
17 |
|
18 |
# Change ownership of the files to allow npm install
|
19 |
+
RUN chown -R node:node /tmp/code
|
20 |
|
21 |
# Switch to the node user
|
22 |
USER node
|
23 |
|
24 |
+
# Install dependencies in the temporary directory
|
25 |
+
RUN npm install --prefix /tmp/code
|
26 |
+
|
27 |
+
# Switch back to the root user
|
28 |
+
USER root
|
29 |
|
30 |
+
# Copy the rest of the application code to the working directory
|
31 |
COPY . .
|
32 |
|
33 |
+
# Copy dependencies from the temporary directory to the working directory
|
34 |
+
RUN cp -a /tmp/code/node_modules /code/
|
35 |
+
|
36 |
+
|
37 |
# Expose any necessary ports
|
38 |
EXPOSE 7860
|
39 |
|