Following the documentation in uvicorn-gunicorn-fastapi-docker I should run my image by running:
docker run -d -p 80:80 -v $(pwd):/app myimage /start-reload.sh
But I get:
Usage: uvicorn [OPTIONS]
Try 'uvicorn --help' for help.
Error: Got unexpected extra argument (/start-reload.sh)
I managed to mount a volume by using what I found here Debug mode? but I think it is not elegant enough and I have to run it every time I make a change (at least I dont have to build the image)
docker run --name ${containerName} \
--env GUNICORN_CMD_ARGS="--reload" \
-p 5000:5000 \
-v $(pwd)/app:/app \
${imageName}:${versionTag}
My Dockerfile it is just:
FROM tiangolo/uvicorn-gunicorn-fastapi:latest
EXPOSE 5000
COPY ./app /app
ENTRYPOINT ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "5000"]
And It works as supposed.
It is possible to be able to reload as I changing my code?