feat: make host port configurable via APP_PORT env var

Allow users to customize the host-side port mapping while keeping the
container's internal port fixed at 3000. The default remains 3000 when
APP_PORT is unset.

- Add APP_PORT to .env.example with documentation
- Update docker-compose.yml to use ${APP_PORT:-3000}:3000
- Update README with new env var and usage notes
This commit is contained in:
Brian Fertig 2026-08-12 13:15:41 -06:00
parent a5190199d7
commit a1cdb31e49
3 changed files with 14 additions and 5 deletions

View File

@ -12,3 +12,7 @@ AUTH_SECRET="replace-with-a-generated-secret"
POSTGRES_USER=organize
POSTGRES_PASSWORD=organize
POSTGRES_DB=organize
# Host port the "app" service is published on (e.g. http://localhost:3000).
# The container always listens on 3000 internally regardless of this value.
APP_PORT=3000

View File

@ -69,10 +69,11 @@ the Compose plugin.
migrations automatically on every boot before serving traffic. No
separate migration or setup step is needed.
4. **Open the app** at [http://localhost:3000](http://localhost:3000) and
sign up. The very first account created becomes the site's
administrator; everyone after that follows whatever
[sign-up mode](#sign-up-modes) is currently set (Open, by default).
4. **Open the app** at [http://localhost:3000](http://localhost:3000) (or
whatever `APP_PORT` you set) and sign up. The very first account
created becomes the site's administrator; everyone after that follows
whatever [sign-up mode](#sign-up-modes) is currently set (Open, by
default).
### Updating
@ -105,6 +106,7 @@ Docker Compose (see `.env.example` for the template).
| `POSTGRES_USER` | `db` | Postgres superuser created on first init. |
| `POSTGRES_PASSWORD` | `db` | Password for `POSTGRES_USER`. Change this from the `.env.example` placeholder. |
| `POSTGRES_DB` | `db` | Database name created on first init. |
| `APP_PORT` | `app` (host mapping only) | Host port the app is published on, e.g. `3000` for `http://localhost:3000`. Defaults to `3000` if unset. The container always listens on 3000 internally regardless of this value. |
| `DATABASE_URL` | host-side tooling only | Prisma connection string for running things like `npx prisma studio` from your own machine. **Not** used by the `app` container itself — see note below. |
> **Note on `DATABASE_URL`:** inside `docker-compose.yml`, the `app`

View File

@ -30,4 +30,7 @@ services:
AUTH_SECRET: ${AUTH_SECRET}
NODE_ENV: production
ports:
- "3000:3000"
# Host-side port only -- the container itself always listens on
# 3000 internally (see Dockerfile's EXPOSE). Defaults to 3000 if
# APP_PORT isn't set.
- "${APP_PORT:-3000}:3000"