Skip to content

Commit 5a3e5df

Browse files
authored
Merge pull request #8 from prithaxdev/sprint-2/feat-railway-deploy
chore: add Railway deployment config for FastAPI
2 parents 4fb5cce + 9fed0d9 commit 5a3e5df

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

apps/api/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@ FROM python:3.12-slim
22

33
WORKDIR /app
44

5+
# Install deps first (better layer caching)
56
COPY pyproject.toml .
67
RUN pip install --no-cache-dir -e .
78

89
COPY . .
910

11+
# PORT is injected by Railway at runtime
1012
EXPOSE 8000
11-
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
13+
CMD ["sh", "-c", "uvicorn app.main:app --host 0.0.0.0 --port ${PORT:-8000}"]

apps/api/railway.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[build]
2+
builder = "dockerfile"
3+
dockerfilePath = "Dockerfile"
4+
5+
[deploy]
6+
startCommand = "uvicorn app.main:app --host 0.0.0.0 --port $PORT"
7+
healthcheckPath = "/api/health"
8+
healthcheckTimeout = 30
9+
restartPolicyType = "on_failure"

0 commit comments

Comments
 (0)