Fix docker access. Closes #278
Some checks failed
docker-build / platform-excludes (push) Has been cancelled
pre-commit / pre-commit (push) Has been cancelled
Run Pytest on Pull Request / test (push) Has been cancelled
docker-build / build (push) Has been cancelled
docker-build / merge (push) Has been cancelled

* Need to start within container with host 0.0.0.0 to access it later
   on host.
This commit is contained in:
Dominique Lasserre 2025-01-24 00:09:28 +01:00 committed by Bobby Noelte
parent 3b142ad514
commit f09658578a
3 changed files with 12 additions and 6 deletions

View File

@ -28,13 +28,17 @@ COPY requirements.txt .
RUN --mount=type=cache,target=/root/.cache/pip \ RUN --mount=type=cache,target=/root/.cache/pip \
pip install -r requirements.txt pip install -r requirements.txt
COPY src . COPY pyproject.toml .
RUN mkdir -p src && pip install -e .
COPY src src
USER eos USER eos
ENTRYPOINT [] ENTRYPOINT []
EXPOSE 8503 EXPOSE 8503
EXPOSE 8504
CMD ["python", "-m", "akkudoktoreos.server.eos"] CMD ["python", "src/akkudoktoreos/server/eos.py", "--host", "0.0.0.0"]
VOLUME ["${MPLCONFIGDIR}", "${EOS_CACHE_DIR}", "${EOS_OUTPUT_DIR}", "${EOS_CONFIG_DIR}"] VOLUME ["${MPLCONFIGDIR}", "${EOS_CACHE_DIR}", "${EOS_OUTPUT_DIR}", "${EOS_CONFIG_DIR}"]

View File

@ -1,6 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import argparse import argparse
import os
import subprocess import subprocess
import sys import sys
from contextlib import asynccontextmanager from contextlib import asynccontextmanager
@ -945,8 +946,8 @@ def run_eos(host: str, port: int, log_level: str, access_log: bool, reload: bool
Returns: Returns:
None None
""" """
# Make hostname human (and Windows) friendly # Make hostname Windows friendly
if host == "0.0.0.0": if host == "0.0.0.0" and os.name == "nt":
host = "localhost" host = "localhost"
try: try:
uvicorn.run( uvicorn.run(

View File

@ -1,4 +1,5 @@
import argparse import argparse
import os
import uvicorn import uvicorn
from fasthtml.common import H1, FastHTML, Table, Td, Th, Thead, Titled, Tr from fasthtml.common import H1, FastHTML, Table, Td, Th, Thead, Titled, Tr
@ -69,8 +70,8 @@ def run_eosdash(host: str, port: int, log_level: str, access_log: bool, reload:
Returns: Returns:
None None
""" """
# Make hostname human (and Windows) friendly # Make hostname Windows friendly
if host == "0.0.0.0": if host == "0.0.0.0" and os.name == "nt":
host = "localhost" host = "localhost"
try: try:
uvicorn.run( uvicorn.run(