ZeroxAdvanced
Help with Dockerfile, mouting volumes and executing python scripts from subfolders
@Brody hi the scripts will only be uploaded by our dev team. Nu public release but only internal usage. . Ok you mean i would have just place the scripts in another folder that is not mounted essentially? Can you confirm ? Then I know the right approach.
10 replies
Help with Dockerfile, mouting volumes and executing python scripts from subfolders
@Brody ok i have archieved similar with below dockerfile. However I have one question:
Here is my docker file.
and my volume path is /code/media
I can access and save files fine e.g. csv files in my media folder that i create at runtime. However I would like to run scripts from my media folder, so you say the approach is to have my scripts in another folder?
e..g
media/supplier/allcam/products.csv <-- persistant file
create new folder (that is not in media volume)
scripts/supplier/allcam/import.py
and deploy the scripts via github?
then I only use the media/supplier folder as a persistant storage?
So in general the volume is used to create only files at runtime and not place my scripts?
My endgoals is that users also can modify and upload scripts in the volume and not only via deployment.
10 replies
Help with Dockerfile, mouting volumes and executing python scripts from subfolders
Using this configuration I cannot execute the scripts in my folder structure from my media/suppliers/allcam and it seems that not all files are copied.
Question: Can someone provide an example how to make the dockerfile copy the whole project and setup the railway volume?
My goals is to execute the scripts at runtime not from the root but media/suppliers/allcam folder.
Locally the script exection is working fine with the workdir() which provides me the current workdir.
I think something must be mis configured in the Volume or Dockerfile. Any help or suggestions are appriciated!
10 replies
Not correct python version in Nixpack when using dockerfile (used to work)
@Brody Hi there I think you are right! I had vscode open en had it named .Dockerfile should of course be "Dockerfile"...Deployed already 8 projects to Railway and never forgot this. Well now is the first time! Thanks for the solution!👍 Deployed again and working!
7 replies
NiceGUI deployment to Railway help with dockerfile
@Brody thanks for the help! You pointed me in the good direction with the example in the github code! I was able to solve it with some more code examples. Hope this solution will help the railway community. Thanks again and have nice evening.
49 replies
NiceGUI deployment to Railway help with dockerfile
ERROR: Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 677, in lifespan
async with self.lifespan_context(app) as maybe_state:
File "/usr/local/lib/python3.10/contextlib.py", line 199, in __aenter__
return await anext(self.gen)
File "/usr/local/lib/python3.10/site-packages/nicegui/nicegui.py", line 29, in _lifespan
_startup()
File "/usr/local/lib/python3.10/site-packages/nicegui/nicegui.py", line 83, in _startup
raise RuntimeError('\n\n'
RuntimeError:
You must call ui.run() to start the server.
If ui.run() is behind a main guard
if __name__ == "__main__":
remove the guard or replace it with
if __name__ in {"__main__", "__mp_main__"}:
to allow for multiprocessing.
ERROR: Application startup failed. Exiting.
I think it must be configured in the main.app aswell as shown in the link provided earlier. Just changing the dockerfile with the CMD uvicorn doesnt help yet. Will let you know and tinker more49 replies
NiceGUI deployment to Railway help with dockerfile
ui.run_with(
fastapi_app,
storage_secret='pick your private secret here', # NOTE setting a secret is optional but allows for persistent storage per user
)
I see they using the run_with and then some parameters for Fast API..
49 replies
NiceGUI deployment to Railway help with dockerfile
yes tried this already but there is no main:app defnition in my main.py as NiceGui doesnt require this. Basically i do this when creating a fast API app, but here its not required and i dont see it in the code examples
49 replies
NiceGUI deployment to Railway help with dockerfile
aiofiles==23.2.1
aiohttp==3.8.6
aiosignal==1.3.1
annotated-types==0.6.0
anyio==3.7.1
async-timeout==4.0.3
attrs==23.1.0
bidict==0.22.1
certifi==2023.7.22
charset-normalizer==3.3.2
click==8.1.7
exceptiongroup==1.1.3
fastapi==0.104.1
fastapi-socketio==0.0.10
frozenlist==1.4.0
h11==0.14.0
httpcore==1.0.1
httptools==0.6.1
httpx==0.25.1
idna==3.4
ifaddr==0.2.0
itsdangerous==2.1.2
Jinja2==3.1.2
markdown2==2.4.10
MarkupSafe==2.1.3
multidict==6.0.4
nicegui==1.4.2
orjson==3.9.10
pscript==0.7.7
pydantic==2.4.2
pydantic_core==2.10.1
Pygments==2.16.1
python-dotenv==1.0.0
python-engineio==4.8.0
python-multipart==0.0.6
python-socketio==5.10.0
PyYAML==6.0.1
requests==2.31.0
simple-websocket==1.0.0
sniffio==1.3.0
starlette==0.27.0
typing_extensions==4.8.0
urllib3==2.0.7
uvicorn==0.22.0
uvloop==0.19.0
vbuild==0.8.2
watchfiles==0.21.0
websockets==12.0
wsproto==1.2.0
yarl==1.9.2
49 replies