-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
Initializing the backend in production #1177
-
First Check
- I added a very descriptive title here.
- I used the GitHub search to find a similar question and didn't find it.
- I searched in the documentation/README.
- I already searched in Google "How to do X" and didn't find any information.
- I already read and followed all the tutorial in the docs/README and didn't find an answer.
Commit to Help
- I commit to help with one of those options 👆
Example Code
`uvicorn main:app --reload`
Description
I'm struggling to understand the sequence of commands in backend dockerfile
the Dockerfile runs uvicorn main:app --reload when importing the Dockerfile from FROM tiangolo/uvicorn-gunicorn-fastapi:python3.10
with command CMD ["/start.sh"] is there!
however `COPY ./app /app/app takes place till the end here .
How is unicorn being executed without the app? does this mean CMD at the end of tiangolo/uvicorn-gunicorn-fastapi:python3.10 is somehow delayed?
I see that docker-compose.override.yml has
command: /start-reload.sh
which executes uvicorn
however I can't understand how does docker-compose.yml work in production
Operating System
macOS
Operating System Details
docker
Python Version
3.9
Additional Context
No response
Beta Was this translation helpful? Give feedback.
All reactions
In current implementation, there is a command defined in in .Dockerfile:
CMD ["fastapi", "run", "--workers", "4", "app/main.py"]`
And for development, this command is overridden in docker-compose.override.yml:
backend:
...
command:
- fastapi
- run
- --reload
- "app/main.py"
So, in production, the command defined in .Dockerfile is used
Replies: 1 comment
-
In current implementation, there is a command defined in in .Dockerfile:
CMD ["fastapi", "run", "--workers", "4", "app/main.py"]`
And for development, this command is overridden in docker-compose.override.yml:
backend:
...
command:
- fastapi
- run
- --reload
- "app/main.py"
So, in production, the command defined in .Dockerfile is used
Beta Was this translation helpful? Give feedback.