Conversation
| CMD ["fastapi", "dev", "--host", "0.0.0.0", "/app/src/uv_docker_example"] | ||
| CMD ["fastapi", "run", "--host", "0.0.0.0", "/app/src/uv_docker_example"] |
There was a problem hiding this comment.
This fixes errors reading /etc/ssl/private and /proc/tty/driver which seem specific to the dev command — I'm not really sure why this isn't a problem in the Dockerfile, presumably it's a difference of base image, but we use dev there since it's an example of a local development image.
There was a problem hiding this comment.
That's weird, is fastapi trying to generate dev certificates?
There was a problem hiding this comment.
Hmmm I tried it with dev rather than run but I can't repro the issue
There was a problem hiding this comment.
Did you just do the build? The error is on run.
docker build -f multistage.Dockerfile . -t uv-multistage
docker run --rm -it --publish 8000:8000 uv-multistage
There was a problem hiding this comment.
Indeed (I had built and ran it), no errors 😅
There was a problem hiding this comment.
Maybe try fastapi dev --no-reload?
I noticed Will watch for changes in these directories: ['/'] rather than /app.
There was a problem hiding this comment.
Doesn't that sort of defeat the point of using dev? :D
I think I prefer run for these images anyway, since they're more production focused with the staged build.
There was a problem hiding this comment.
I only use dev in Dockerfile because it's linked to the compose example.
There was a problem hiding this comment.
Yea I think thats it, workdir is missing in the multistage/standalone versions
There was a problem hiding this comment.
Oh that's interesting, thanks!
Co-authored-by: samypr100 <[email protected]>
Closes #32
Closes #39
Closes #29