Spaces:
Sleeping
Sleeping
API-Handler
commited on
Update Dockerfile
Browse files- Dockerfile +27 -20
Dockerfile
CHANGED
@@ -1,20 +1,27 @@
|
|
1 |
-
# Use Node.js LTS version
|
2 |
-
FROM node:18-slim
|
3 |
-
|
4 |
-
#
|
5 |
-
|
6 |
-
|
7 |
-
#
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Use Node.js LTS version
|
2 |
+
FROM node:18-slim
|
3 |
+
|
4 |
+
# Switch to the "node" user for security
|
5 |
+
USER node
|
6 |
+
|
7 |
+
# Set home to the user's home directory and add local bin to PATH
|
8 |
+
ENV HOME=/home/node \
|
9 |
+
PATH=/home/node/.local/bin:$PATH
|
10 |
+
|
11 |
+
# Set the working directory to the user's home directory
|
12 |
+
WORKDIR $HOME/app
|
13 |
+
|
14 |
+
# Copy package files with correct ownership
|
15 |
+
COPY --chown=node:node package*.json ./
|
16 |
+
|
17 |
+
# Install dependencies
|
18 |
+
RUN npm install
|
19 |
+
|
20 |
+
# Copy the application code with correct ownership
|
21 |
+
COPY --chown=node:node . .
|
22 |
+
|
23 |
+
# Expose port 7860 (required for Hugging Face Spaces)
|
24 |
+
EXPOSE 7860
|
25 |
+
|
26 |
+
# Start the application using Node.js
|
27 |
+
CMD ["node", "src/server.js"]
|