diff --git a/.env.example b/.env.example index f774500..23e8941 100644 --- a/.env.example +++ b/.env.example @@ -1,3 +1,7 @@ +# === Server Port === +# Port the Next.js server listens on (dev and production) +# PORT=3000 + # === Authentication === # Admin user seeded on first run (only if no users exist in DB) AUTH_USER=admin diff --git a/Dockerfile b/Dockerfile index b8915af..792ef4a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -32,9 +32,9 @@ COPY --from=build /app/src/lib/schema.sql ./src/lib/schema.sql RUN mkdir -p .data && chown nextjs:nodejs .data RUN apt-get update && apt-get install -y curl --no-install-recommends && rm -rf /var/lib/apt/lists/* USER nextjs -EXPOSE 3000 ENV PORT=3000 +EXPOSE 3000 ENV HOSTNAME=0.0.0.0 HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \ - CMD curl -f http://localhost:3000/login || exit 1 + CMD curl -f http://localhost:${PORT:-3000}/login || exit 1 CMD ["node", "server.js"] diff --git a/docker-compose.yml b/docker-compose.yml index 9a16156..7ae529a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,7 +3,9 @@ services: build: . container_name: mission-control ports: - - "${MC_PORT:-3000}:3000" + - "${MC_PORT:-3000}:${PORT:-3000}" + environment: + - PORT=${PORT:-3000} env_file: - path: .env required: false diff --git a/package.json b/package.json index 25e8136..91ec7a0 100644 --- a/package.json +++ b/package.json @@ -3,9 +3,9 @@ "version": "1.3.0", "description": "OpenClaw Mission Control — open-source agent orchestration dashboard", "scripts": { - "dev": "next dev --hostname 127.0.0.1", + "dev": "next dev --hostname 127.0.0.1 --port ${PORT:-3000}", "build": "next build", - "start": "next start --hostname 0.0.0.0 --port 3005", + "start": "next start --hostname 0.0.0.0 --port ${PORT:-3000}", "lint": "eslint .", "typecheck": "tsc --noEmit", "test": "vitest run",