Hello,
I looked at your koyeb app, and the Dockerfile you were using seems almost ok.
I think on the last build from dockerfile version you were using, you had an error because you launch the server in development mode, in the current directory.
INFO: Will watch for changes in these directories: ['/']
INFO: Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
INFO: Started reloader process [6] using statreload
ERROR: Error loading ASGI app. Could not import module "app.main".
Traceback (most recent call last):
File "/usr/local/bin/uvicorn", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/uvicorn/main.py", line 426, in main
run(app, **kwargs)
File "/usr/local/lib/python3.9/site-packages/uvicorn/main.py", line 447, in run
ChangeReload(config, target=server.run, sockets=[sock]).run()
File "/usr/local/lib/python3.9/site-packages/uvicorn/supervisors/basereload.py", line 45, in run
if self.should_restart():
File "/usr/local/lib/python3.9/site-packages/uvicorn/supervisors/statreload.py", line 24, in should_restart
for file in self.iter_py_files():
File "/usr/local/lib/python3.9/site-packages/uvicorn/supervisors/statreload.py", line 51, in iter_py_files
for path in list(reload_dir.rglob("*.py")):
File "/usr/local/lib/python3.9/pathlib.py", line 1190, in rglob
for p in selector.select_from(self):
File "/usr/local/lib/python3.9/pathlib.py", line 611, in _select_from
for p in successor_select(starting_point, is_dir, exists, scandir):
File "/usr/local/lib/python3.9/pathlib.py", line 559, in _select_from
entries = list(scandir_it)
OSError: [Errno 22] Invalid argument: '/proc/8/task/8/net'
The issue is that the process is launched in development mode with the --reload
parameter in the /
system root directory.
I think you can remove the ‘–reload’ param and it should be working.
If you want to keep the live reload mode, you could change the WORKDIR and make sure your app is only watching the app directory (which is / in your latest version of the dockerfile).
Hope this helps!
Bastien