From 8f13745c260511a44c7db0754c4dcd04897dad5c Mon Sep 17 00:00:00 2001 From: MrSphay Date: Fri, 15 May 2026 16:46:14 +0200 Subject: [PATCH] Allow configurable host port --- .env.example | 2 +- README.md | 8 ++++---- blueprint.md | 4 ++-- docker-compose.yml | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.env.example b/.env.example index 5e067ea..0e8f8d8 100644 --- a/.env.example +++ b/.env.example @@ -4,4 +4,4 @@ NEXTAUTH_SECRET="change-me-with-openssl-rand-base64-32" POSTGRES_DB="watchlink" POSTGRES_USER="watchlink" POSTGRES_PASSWORD="watchlink" -PORT="3000" +HOST_PORT="3000" diff --git a/README.md b/README.md index 9a03d6c..a31909d 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ POSTGRES_USER=watchlink POSTGRES_PASSWORD=change-this-database-password NEXTAUTH_URL=https://watchlink.example.com NEXTAUTH_SECRET=change-this-with-openssl-rand-base64-32 -PORT=3000 +HOST_PORT=6852 ``` For local testing, use: @@ -61,7 +61,7 @@ POSTGRES_USER=watchlink POSTGRES_PASSWORD=watchlink NEXTAUTH_URL=http://localhost:3000 NEXTAUTH_SECRET=change-me-with-openssl-rand-base64-32 -PORT=3000 +HOST_PORT=3000 ``` Minimal `docker-compose.yml` using the published Gitea image: @@ -93,7 +93,7 @@ services: NEXTAUTH_SECRET: ${NEXTAUTH_SECRET:-change-me-with-openssl-rand-base64-32} PORT: 3000 ports: - - "3000:3000" + - "${HOST_PORT:-3000}:3000" command: sh -c "npx prisma migrate deploy && node server.js" volumes: @@ -106,7 +106,7 @@ Start the stack: docker compose up --build ``` -The Compose stack exposes the web app on `http://localhost:3000` and uses a Postgres volume named `watchlink_postgres-data`. +The Compose stack exposes the web app on `http://localhost:${HOST_PORT:-3000}` and uses a Postgres volume named `watchlink_postgres-data`. Keep the container `PORT` at `3000`; change `HOST_PORT` when another container already uses port 3000 on the host. Build and publish the Gitea image: diff --git a/blueprint.md b/blueprint.md index 3acbdf1..17cecc5 100644 --- a/blueprint.md +++ b/blueprint.md @@ -37,7 +37,7 @@ POSTGRES_USER=watchlink POSTGRES_PASSWORD=change-this-database-password NEXTAUTH_URL=https://watchlink.example.com NEXTAUTH_SECRET=change-this-with-openssl-rand-base64-32 -PORT=3000 +HOST_PORT=6852 ``` Minimal Compose using the published image: @@ -69,7 +69,7 @@ services: NEXTAUTH_SECRET: ${NEXTAUTH_SECRET:-change-me-with-openssl-rand-base64-32} PORT: 3000 ports: - - "3000:3000" + - "${HOST_PORT:-3000}:3000" command: sh -c "npx prisma migrate deploy && node server.js" volumes: diff --git a/docker-compose.yml b/docker-compose.yml index 405eb1c..d8c93da 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -25,7 +25,7 @@ services: NEXTAUTH_SECRET: ${NEXTAUTH_SECRET:-change-me-with-openssl-rand-base64-32} PORT: 3000 ports: - - "3000:3000" + - "${HOST_PORT:-3000}:3000" command: sh -c "npx prisma migrate deploy && node server.js" volumes: