From 15bf14728ac9831523422ced0eff7db7cebe52ac Mon Sep 17 00:00:00 2001 From: Lucas Winther Date: Fri, 10 Jul 2026 05:38:00 +0200 Subject: [PATCH] Allow changing port via env --- Dockerfile | 3 ++- docker-compose.yml | 3 ++- src/index.ts | 7 ++++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5b8a924..78da403 100644 --- a/Dockerfile +++ b/Dockerfile @@ -32,5 +32,6 @@ COPY --from=build /app/dist ./dist RUN mkdir -p /app/data && chown -R bun:bun /app/data USER bun -EXPOSE 3000 +ENV PORT=3000 +EXPOSE $PORT CMD ["bun", "src/index.ts"] diff --git a/docker-compose.yml b/docker-compose.yml index 0cb46c4..6561c8b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,8 +2,9 @@ services: whisper-web: build: . ports: - - "3000:3000" + - "${PORT:-3000}:${PORT:-3000}" environment: + PORT: "${PORT:-3000}" # Runtime feature flags (Decisions.md D-015). AUTH_ENABLED: "true" # set to "false" to disable login/register volumes: diff --git a/src/index.ts b/src/index.ts index 7d2f96f..9280082 100644 --- a/src/index.ts +++ b/src/index.ts @@ -189,9 +189,10 @@ async function developmentServeOptions(): Promise { // --------------------------------------------------------------------------- -const server = serve( - IS_PRODUCTION ? await productionServeOptions() : await developmentServeOptions(), -); +const options = IS_PRODUCTION ? await productionServeOptions() : await developmentServeOptions(); +options.port = process.env.PORT || 3000; + +const server = serve(options); console.log( `Server running at ${server.url} (${IS_PRODUCTION ? "production, serving dist/" : "development"})`,