Explorar o código

add NO_NETIFACES env variable for docker releases

Rodja Trappe hai 1 ano
pai
achega
997bed8e93
Modificáronse 3 ficheiros con 4 adicións e 2 borrados
  1. 1 1
      nicegui/welcome.py
  2. 2 1
      release.dockerfile
  3. 1 0
      website/documentation.py

+ 1 - 1
nicegui/welcome.py

@@ -41,6 +41,6 @@ async def print_message() -> None:
     if len(urls) >= 2:
         urls[-1] = 'and ' + urls[-1]
     extra = ''
-    if 'netifaces' not in globals.optional_features:
+    if 'netifaces' not in globals.optional_features and os.environ.get('NO_NETIFACES', 'false').lower() != 'true':
         extra = ' (install netifaces to show all IPs and speedup this message)'
     print(f'on {", ".join(urls)}' + extra, flush=True)

+ 2 - 1
release.dockerfile

@@ -3,7 +3,7 @@ ARG VERSION
 
 LABEL maintainer="Zauberzeug GmbH <info@zauberzeug.com>"
 
-RUN python -m pip install nicegui==$VERSION itsdangerous isort docutils requests netifaces
+RUN python -m pip install nicegui==$VERSION itsdangerous isort docutils requests
 
 WORKDIR /app
 
@@ -16,6 +16,7 @@ RUN chmod 777 /resources/docker-entrypoint.sh
 
 EXPOSE 8080
 ENV PYTHONUNBUFFERED True
+ENV NO_NETIFACES=1
 
 ENTRYPOINT ["/resources/docker-entrypoint.sh"]
 CMD ["python", "main.py"]

+ 1 - 0
website/documentation.py

@@ -617,6 +617,7 @@ def create_full() -> None:
             This will make `ui.pyplot` and `ui.line_plot` unavailable.
         - `NICEGUI_STORAGE_PATH` (default: local ".nicegui") can be set to change the location of the storage files.
         - `MARKDOWN_CONTENT_CACHE_SIZE` (default: 1000): The maximum number of Markdown content snippets that are cached in memory.
+        - `NO_NETIFACES` (default: `false`): Can be set to `true` to hide the netifaces startup warning (e.g. in docker container).
     ''')
     def env_var_demo():
         from nicegui.elements import markdown