Commit ·
0c86b26
1
Parent(s): 1411fe8
update
Browse files- Dockerfile +13 -13
Dockerfile
CHANGED
|
@@ -1,26 +1,26 @@
|
|
| 1 |
-
# Use
|
| 2 |
FROM node:20-alpine
|
| 3 |
|
| 4 |
-
# Set
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
-
#
|
|
|
|
|
|
|
|
|
|
| 8 |
COPY package*.json ./
|
| 9 |
|
| 10 |
-
# Install
|
| 11 |
-
RUN npm
|
| 12 |
|
| 13 |
-
# Copy the rest of the
|
| 14 |
COPY . .
|
| 15 |
|
| 16 |
-
# Build
|
| 17 |
-
RUN
|
| 18 |
-
|
| 19 |
-
# # Remove dev dependencies to reduce image size
|
| 20 |
-
# RUN npm prune --production
|
| 21 |
|
| 22 |
-
# Expose Hugging Face default port
|
| 23 |
EXPOSE 7860
|
| 24 |
|
| 25 |
# Start Next.js on port 7860
|
| 26 |
-
CMD ["
|
|
|
|
| 1 |
+
# Use Node.js 20 (LTS) on Alpine for small image size
|
| 2 |
FROM node:20-alpine
|
| 3 |
|
| 4 |
+
# Set working directory inside container
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
+
# Upgrade npm first (fixes "Exit handler never called!" bug)
|
| 8 |
+
RUN npm install -g npm@11.6.0
|
| 9 |
+
|
| 10 |
+
# Copy package files (for dependency install layer)
|
| 11 |
COPY package*.json ./
|
| 12 |
|
| 13 |
+
# Install dependencies (include devDependencies for build step)
|
| 14 |
+
RUN npm install --legacy-peer-deps
|
| 15 |
|
| 16 |
+
# Copy the rest of the source code
|
| 17 |
COPY . .
|
| 18 |
|
| 19 |
+
# Build Next.js application
|
| 20 |
+
RUN npm run build
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
+
# Expose Hugging Face Spaces default port
|
| 23 |
EXPOSE 7860
|
| 24 |
|
| 25 |
# Start Next.js on port 7860
|
| 26 |
+
CMD ["npm", "start", "--", "-p", "7860"]
|