Update Dockerfile
Browse files- Dockerfile +17 -17
Dockerfile
CHANGED
|
@@ -1,24 +1,24 @@
|
|
| 1 |
-
# Use official Node.js
|
| 2 |
-
FROM node:
|
| 3 |
|
| 4 |
-
#
|
| 5 |
-
|
| 6 |
|
| 7 |
-
#
|
| 8 |
-
|
| 9 |
-
# We do this first so Docker caches the "npm install" step if dependencies haven't changed.
|
| 10 |
-
COPY package*.json ./
|
| 11 |
|
| 12 |
-
#
|
| 13 |
-
|
|
|
|
|
|
|
| 14 |
|
| 15 |
-
#
|
| 16 |
-
#
|
| 17 |
-
|
| 18 |
|
| 19 |
-
# Expose port
|
| 20 |
EXPOSE 7860
|
|
|
|
| 21 |
|
| 22 |
-
#
|
| 23 |
-
|
| 24 |
-
CMD ["node", "app/index.js"]
|
|
|
|
| 1 |
+
# Step 1: Use an official Node.js runtime as the base image
|
| 2 |
+
FROM node:20-slim
|
| 3 |
|
| 4 |
+
# Install git so we can clone the repo
|
| 5 |
+
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
|
| 6 |
|
| 7 |
+
# Set the working directory inside the container
|
| 8 |
+
WORKDIR /app
|
|
|
|
|
|
|
| 9 |
|
| 10 |
+
# --- THE FIX IS HERE ---
|
| 11 |
+
# Mount the Hugging Face secret safely during the build layer
|
| 12 |
+
RUN --mount=type=secret,id=GIT_REPO_URL,mode=0444,required=true \
|
| 13 |
+
git clone $(cat /run/secrets/GIT_REPO_URL) .
|
| 14 |
|
| 15 |
+
# Install project dependencies
|
| 16 |
+
# Replace the old npm ci line with this:
|
| 17 |
+
RUN npm install --omit=dev
|
| 18 |
|
| 19 |
+
# Expose the port your app runs on
|
| 20 |
EXPOSE 7860
|
| 21 |
+
ENV PORT=7860
|
| 22 |
|
| 23 |
+
# Start the application
|
| 24 |
+
CMD ["npm", "start"]
|
|
|