Heroku docker(FastAPI) deployment error: "code=H10 desc="App crashed" method=GET"

Viewed 259

I'm trying to deploy my docker image via heroku. I'm using FastAPI for the api calls. This is the code of my docker file:

 FROM --platform=arm64 continuumio/miniconda3

 WORKDIR /

 RUN pip install numpy
 RUN pip install fastapi
 RUN pip install uvicorn
 RUN pip install yfinance
 RUN conda install -c conda-forge prophet

 COPY . . 


 CMD uvicorn app.api:app --reload --host 0.0.0.0 --port $PORT

And the command I'm using to run this image locally is:

docker run --name fastapi-ml -e PORT=8008 -p 8008:8008 -d registry.heroku.com/{App-Name}/web:latest

But when I'm pushing and releasing the container on heroku I'm getting application error and these are my logs

2022-04-05T02:24:22.355803+00:00 app[web.1]: Error: Exec format error
2022-04-05T02:24:22.496388+00:00 heroku[web.1]: Process exited with status 126
2022-04-05T02:24:22.545259+00:00 heroku[web.1]: State changed from starting to crashed
2022-04-05T02:24:22.552848+00:00 heroku[web.1]: State changed from crashed to starting
2022-04-05T02:24:47.551314+00:00 heroku[web.1]: Starting process with command `/bin/sh -c uvicorn\ app.api:app\ --reload\ --host\ 0.0.0.0\ --port\ \34834`
2022-04-05T02:24:48.621213+00:00 app[web.1]: Error: Exec format error
2022-04-05T02:24:48.774817+00:00 heroku[web.1]: Process exited with status 126
2022-04-05T02:24:48.954256+00:00 heroku[web.1]: State changed from starting to crashed
2022-04-05T02:24:51.196493+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=App-Name.herokuapp.com request_id=ff7e11e1-a4c9-4161-a99a-b3a27046b8a2 fwd="49.36.177.115" dyno= connect= service= status=503 bytes= protocol=https
2022-04-05T02:24:51.700751+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=App-Name.herokuapp.com request_id=23776f41-5254-4c0b-b499-086abbf08bfa fwd="49.36.177.115" dyno= connect= service= status=503 bytes= protocol=https

Can someone help me on this, I think this is happening because of the way heroku assigns port? Or should I include EXPOSE command in my docker file? (tired that as well)

0 Answers
Related