PeterPinetree commited on
Commit
e93f144
·
1 Parent(s): e747ec5

fix(startup): honor everywhere; default PORT=7860; start binds -H 0.0.0.0

Browse files
Files changed (2) hide show
  1. Dockerfile +4 -3
  2. package.json +1 -1
Dockerfile CHANGED
@@ -17,10 +17,11 @@ RUN npm run build
17
  # Expose the port expected by Hugging Face Docker Spaces
18
  EXPOSE 7860
19
 
20
- # HF Spaces provides $PORT. Start Next.js on that port and bind to all interfaces.
21
  ENV HOST=0.0.0.0
 
 
22
  # Disable telemetry and ensure production env
23
  ENV NEXT_TELEMETRY_DISABLED=1
24
  ENV NODE_ENV=production
25
- # Run Next directly on the fixed port used by Spaces
26
- CMD ["sh", "-c", "node node_modules/next/dist/bin/next start -H 0.0.0.0 -p 7860"]
 
17
  # Expose the port expected by Hugging Face Docker Spaces
18
  EXPOSE 7860
19
 
 
20
  ENV HOST=0.0.0.0
21
+ # Default to the Space port, but allow HF to override
22
+ ENV PORT=7860
23
  # Disable telemetry and ensure production env
24
  ENV NEXT_TELEMETRY_DISABLED=1
25
  ENV NODE_ENV=production
26
+ # Run Next directly and honor $PORT
27
+ CMD ["sh", "-c", "node node_modules/next/dist/bin/next start -H 0.0.0.0 -p ${PORT}"]
package.json CHANGED
@@ -5,7 +5,7 @@
5
  "scripts": {
6
  "dev": "next dev --turbopack",
7
  "build": "next build",
8
- "start": "next start",
9
  "lint": "next lint"
10
  },
11
  "dependencies": {
 
5
  "scripts": {
6
  "dev": "next dev --turbopack",
7
  "build": "next build",
8
+ "start": "next start -H 0.0.0.0 -p ${PORT:-7860}",
9
  "lint": "next lint"
10
  },
11
  "dependencies": {