2 years ago
I have been trying to deploy my first Fast API from my github to Railway.app but it is failing all the time.
I followed this
https://docs.railway.com/guides/fastapi
but still not sure what I am doing wrong
This is the error message
==============
context: a4eb69852c369aaacddef3bb0c4277bc
╔══════════════════════════════ Nixpacks v1.29.1 ══════════════════════════════╗
║ setup │ python3, gcc ║
║──────────────────────────────────────────────────────────────────────────────║
║ build │ pip install --no-cache-dir -r requirements.txt ║
║──────────────────────────────────────────────────────────────────────────────║
║ start │ python3 -m uvicorn smartsynch.api.main:app --host 0.0.0.0 ║
║ │ --port $PORT ║
╚══════════════════════════════════════════════════════════════════════════════╝
#0 building with "builder-MCHC" instance using docker-container driver
#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile: 2.46kB done
#1 DONE 0.0s
#2 [internal] load metadata for ghcr.io/railwayapp/nixpacks:ubuntu-1731369831
#2 DONE 0.1s
#3 [stage-0 1/10] FROM ghcr.io/railwayapp/nixpacks:ubuntu-1731369831@sha256:248c718af9f76e602170a3cdbf69658edf55c910023104e1f277e517b77977a0
#3 resolve ghcr.io/railwayapp/nixpacks:ubuntu-1731369831@sha256:248c718af9f76e602170a3cdbf69658edf55c910023104e1f277e517b77977a0 0.0s done
#3 DONE 0.0s
#4 [stage-0 4/8] RUN nix-env -if .nixpacks/nixpkgs-bf446f08bff6814b569265bef8374cfdd3d8f0e0.nix && nix-collect-garbage -d
#4 CACHED
#5 [stage-0 2/10] WORKDIR /app/
#5 CACHED
#6 [internal] load .dockerignore
#6 transferring context: 2B done
#6 DONE 0.0s
#7 [internal] load build context
#7 transferring context: 350.03kB 0.0s done
#7 DONE 0.0s
#8 [3/7] COPY .nixpacks/nixpkgs-bf446f08bff6814b569265bef8374cfdd3d8f0e0.nix .nixpacks/nixpkgs-bf446f08bff6814b569265bef8374cfdd3d8f0e0.nix
#8 CACHED
#9 [4/7] RUN nix-env -if .nixpacks/nixpkgs-bf446f08bff6814b569265bef8374cfdd3d8f0e0.nix && nix-collect-garbage -d
#9 CACHED
#10 [5/7] COPY . /app/.
#10 DONE 0.2s
#11 [6/7] RUN pip install --no-cache-dir -r requirements.txt
#11 0.097 /bin/bash: line 1: pip: command not found
#11 ERROR: process "/bin/bash -ol pipefail -c pip install --no-cache-dir -r requirements.txt" did not complete successfully: exit code: 127
[6/7] RUN pip install --no-cache-dir -r requirements.txt:
0.097 /bin/bash: line 1: pip: command not found
Dockerfile:22
20 | # build phase 21 | COPY . /app/. 22 | >>> RUN pip install --no-cache-dir -r requirements.txt 23 | 24 |
ERROR: failed to solve: process "/bin/bash -ol pipefail -c pip install --no-cache-dir -r requirements.txt" did not complete successfully: exit code: 127
Error: Docker build failed
and my Docker file looks like this
FROM python:3-alpine
WORKDIR /app
Copy local code to the container image
COPY . .
Install project dependencies
RUN pip install --no-cache-dir -r requirements.txt
Run the web service on container startup
CMD ["uvicorn", "smartsynch.api.main:app", "--host", "0.0.0.0", "--port", "8000"]
What am I doing wrong?
Is it something in the Service Settings maybe that I am missing?
Providers is set to Python, my Custom Command Build is "pip install --no-cache-dir -r requirements.txt" and Custom Start Command is "python3 -m uvicorn smartsynch.api.main:app --host 0.0.0.0 --port $PORT"
Any help very much appreciated!
ⓘ Deployment information is only viewable by project members and Railway employees.
3 Replies
brody
Look at the repo attached to the service, that is not a python app.
2 years ago
what do you mean not a python app? do you mean my github repo? dev branch is. main branch I still need to push when I am happy with the dev branch
Status changed to Closed brody • over 1 year ago