Spaces:
Sleeping
Sleeping
updated dockerfile
Browse files- Dockerfile +8 -13
Dockerfile
CHANGED
|
@@ -1,27 +1,22 @@
|
|
| 1 |
-
# Use
|
| 2 |
-
# Using the 'alpine' variant for a smaller image size.
|
| 3 |
FROM node:18-alpine
|
| 4 |
|
| 5 |
# Set the working directory inside the container
|
| 6 |
WORKDIR /app
|
| 7 |
|
| 8 |
-
# Copy package
|
| 9 |
COPY package*.json ./
|
| 10 |
-
|
| 11 |
-
# Install app dependencies
|
| 12 |
RUN npm install
|
| 13 |
|
| 14 |
-
# Copy the rest of your application
|
| 15 |
-
# This includes index.js, the 'views' directory, and the 'dist' directory
|
| 16 |
COPY . .
|
| 17 |
|
| 18 |
-
#
|
| 19 |
-
EXPOSE
|
| 20 |
|
| 21 |
-
# Metadata for Hugging Face Spaces
|
| 22 |
-
|
| 23 |
-
LABEL "app_port"="3000"
|
| 24 |
LABEL "app_file"="index.js"
|
| 25 |
|
| 26 |
-
# The command to
|
| 27 |
CMD ["node", "index.js"]
|
|
|
|
| 1 |
+
# Use a stable and small Node.js image
|
|
|
|
| 2 |
FROM node:18-alpine
|
| 3 |
|
| 4 |
# Set the working directory inside the container
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
+
# Copy package files and install dependencies first to leverage Docker's layer caching
|
| 8 |
COPY package*.json ./
|
|
|
|
|
|
|
| 9 |
RUN npm install
|
| 10 |
|
| 11 |
+
# Copy the rest of your application code
|
|
|
|
| 12 |
COPY . .
|
| 13 |
|
| 14 |
+
# Expose the port that Hugging Face Spaces expects
|
| 15 |
+
EXPOSE 7860
|
| 16 |
|
| 17 |
+
# Metadata for Hugging Face Spaces to identify the running application port
|
| 18 |
+
LABEL "app_port"="7860"
|
|
|
|
| 19 |
LABEL "app_file"="index.js"
|
| 20 |
|
| 21 |
+
# The command to start your Express server
|
| 22 |
CMD ["node", "index.js"]
|