Skip to content

Commit cde265b

Browse files
Setup Railway deploy for backend folder
1 parent 8303822 commit cde265b

2 files changed

Lines changed: 5 additions & 9 deletions

File tree

nixpacks.toml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,24 @@
11
[phases.setup]
2-
nixPkgs = ["python312Full"]
2+
nixPkgs = ["python312Full"] # Includes Python 3.12 + pip
33

4-
# Use the default Python install behavior but ensure we use the right requirements file
54
[phases.install]
65
cmds = [
6+
# Upgrade pip and install dependencies from backend/requirements.txt
77
"/opt/venv/bin/python -m pip install --upgrade pip",
88
"/opt/venv/bin/python -m pip install -r backend/requirements.txt"
99
]
1010

11-
1211
[phases.build]
1312
cmds = [
14-
"echo 'Build phase: Copying backend files'",
15-
"cp -r backend/* . || echo 'Backend files already in place'"
13+
"echo 'Copying backend files to root'",
14+
"cp -r backend/* ."
1615
]
1716

1817
[start]
19-
# Run directly from the root directory since we copied the files there
2018
cmd = "/opt/venv/bin/uvicorn main:app --host 0.0.0.0 --port $PORT"
2119

2220
[variables]
2321
PYTHONPATH = "/app"
2422
PYTHONUNBUFFERED = "1"
2523

26-
# Let Nixpacks handle virtual environment creation automatically
2724
[nixpacks]

railway.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
builder = "NIXPACKS"
33

44
[deploy]
5-
# Updated start command to run directly without cd to backend
6-
startCommand = "uvicorn main:app --host 0.0.0.0 --port $PORT"
5+
startCommand = "/opt/venv/bin/uvicorn main:app --host 0.0.0.0 --port $PORT"
76
restartPolicyType = "ON_FAILURE"
87
restartPolicyMaxRetries = 10
98

0 commit comments

Comments
 (0)