Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +14 -22
Dockerfile
CHANGED
|
@@ -1,34 +1,26 @@
|
|
| 1 |
-
# Use
|
| 2 |
FROM node:20
|
| 3 |
|
| 4 |
-
# Set
|
| 5 |
-
|
| 6 |
-
PATH=/home/node/.local/bin:$PATH
|
| 7 |
|
| 8 |
-
#
|
| 9 |
-
WORKDIR $HOME/app
|
| 10 |
-
|
| 11 |
-
# Install unzip and clean apt cache
|
| 12 |
RUN apt-get update && apt-get install -y unzip && rm -rf /var/lib/apt/lists/*
|
| 13 |
|
| 14 |
-
# Copy
|
| 15 |
COPY --chown=node:node Archive.zip .
|
|
|
|
|
|
|
| 16 |
RUN unzip Archive.zip && rm Archive.zip
|
| 17 |
|
| 18 |
-
#
|
|
|
|
|
|
|
|
|
|
| 19 |
USER node
|
| 20 |
|
| 21 |
-
# Install dependencies
|
| 22 |
RUN npm install
|
| 23 |
|
| 24 |
-
#
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
# Install a lightweight HTTP server to serve dist/
|
| 28 |
-
RUN npm install -g serve
|
| 29 |
-
|
| 30 |
-
# Expose Hugging Face Spaces default port
|
| 31 |
-
EXPOSE 7860
|
| 32 |
-
|
| 33 |
-
# Serve the built files
|
| 34 |
-
CMD ["serve", "-s", "dist", "-l", "7860"]
|
|
|
|
| 1 |
+
# Use official Node.js 20 image
|
| 2 |
FROM node:20
|
| 3 |
|
| 4 |
+
# Set working directory
|
| 5 |
+
WORKDIR /home/node/app
|
|
|
|
| 6 |
|
| 7 |
+
# Install unzip for extracting your archive
|
|
|
|
|
|
|
|
|
|
| 8 |
RUN apt-get update && apt-get install -y unzip && rm -rf /var/lib/apt/lists/*
|
| 9 |
|
| 10 |
+
# Copy the archive and set ownership to 'node' user
|
| 11 |
COPY --chown=node:node Archive.zip .
|
| 12 |
+
|
| 13 |
+
# Unzip the archive and remove the zip file
|
| 14 |
RUN unzip Archive.zip && rm Archive.zip
|
| 15 |
|
| 16 |
+
# Make sure the node user owns everything
|
| 17 |
+
RUN chown -R node:node /home/node/app
|
| 18 |
+
|
| 19 |
+
# Switch to the 'node' user for security and to avoid permission errors
|
| 20 |
USER node
|
| 21 |
|
| 22 |
+
# Install npm dependencies as 'node' user
|
| 23 |
RUN npm install
|
| 24 |
|
| 25 |
+
# Default command to start your app (adjust if your start script differs)
|
| 26 |
+
CMD ["npm", "start"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|