Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Initializing the backend in production #1177

Answered by YuriiMotov
machov asked this question in Questions
Discussion options

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

You must be logged in to vote

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

Comment options

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

You must be logged in to vote
0 replies
Answer selected by YuriiMotov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested

AltStyle によって変換されたページ (->オリジナル) /