From 2c932f03ee7693b9bd7cf889e5f86bd8c4fe095c Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 25 May 2026 08:19:03 +0000 Subject: [PATCH] fix: use start.sh shebang script so PORT expands regardless of Railway invocation Railway's exec-form start command and dashboard overrides both pass args without shell expansion, so \$PORT was never substituted. A #!/bin/sh script is always run through the OS shell via its shebang, making \${PORT:-8080} expansion reliable in every code path. https://claude.ai/code/session_017cLXjZu6kkjXRf2BemMPpp --- apps/api/Dockerfile | 4 +++- apps/api/railway.toml | 2 +- apps/api/start.sh | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 apps/api/start.sh diff --git a/apps/api/Dockerfile b/apps/api/Dockerfile index c4b9366..1f402af 100644 --- a/apps/api/Dockerfile +++ b/apps/api/Dockerfile @@ -9,9 +9,11 @@ RUN pip install --no-cache-dir -r requirements.txt COPY . . +RUN chmod +x start.sh + EXPOSE ${PORT:-8080} HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \ CMD curl -f http://localhost:${PORT:-8080}/health || exit 1 -CMD ["sh", "-c", "uvicorn app.main:app --host 0.0.0.0 --port ${PORT:-8080} --workers 2"] +CMD ["./start.sh"] diff --git a/apps/api/railway.toml b/apps/api/railway.toml index 4dde455..4a2f665 100644 --- a/apps/api/railway.toml +++ b/apps/api/railway.toml @@ -3,7 +3,7 @@ builder = "DOCKERFILE" dockerfilePath = "Dockerfile" [deploy] -startCommand = "sh -c 'uvicorn app.main:app --host 0.0.0.0 --port $PORT --workers 2'" +startCommand = "./start.sh" healthcheckPath = "/health" healthcheckTimeout = 30 restartPolicyType = "ON_FAILURE" diff --git a/apps/api/start.sh b/apps/api/start.sh new file mode 100644 index 0000000..b65c12a --- /dev/null +++ b/apps/api/start.sh @@ -0,0 +1,2 @@ +#!/bin/sh +exec uvicorn app.main:app --host 0.0.0.0 --port "${PORT:-8080}" --workers 2