mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2025-08-23 22:12:23 +00:00
Some checks failed
docker-build / platform-excludes (push) Has been cancelled
docker-build / build (push) Has been cancelled
docker-build / merge (push) Has been cancelled
pre-commit / pre-commit (push) Has been cancelled
Run Pytest on Pull Request / test (push) Has been cancelled
Close stale pull requests/issues / Find Stale issues and PRs (push) Has been cancelled
Fixes the issue where EOSDash is not accessible when running EOS in a Docker container. The problem was that EOSDash was binding to 127.0.0.1 (localhost) by default, making it inaccessible from outside the container. The fix adds a minimal default configuration file during the Docker image build that sets both the EOS server and EOSDash to bind to 0.0.0.0, allowing external access while maintaining security through Docker's network isolation. - Add default EOS.config.json in Dockerfile with server bindings set to 0.0.0.0 - No changes required to docker-compose.yaml - Ensures EOSDash works out of the box for Docker users Fixes: #629 Closes: https://github.com/Akkudoktor-EOS/EOS/issues/629 Co-authored-by: Tobias Welz <tobias.welz@wiznet.eu>
60 lines
1.6 KiB
Docker
60 lines
1.6 KiB
Docker
# syntax=docker/dockerfile:1.7
|
|
ARG PYTHON_VERSION=3.12.7
|
|
FROM python:${PYTHON_VERSION}-slim
|
|
|
|
LABEL source="https://github.com/Akkudoktor-EOS/EOS"
|
|
|
|
ENV MPLCONFIGDIR="/tmp/mplconfigdir"
|
|
ENV EOS_DIR="/opt/eos"
|
|
ENV EOS_CACHE_DIR="${EOS_DIR}/cache"
|
|
ENV EOS_OUTPUT_DIR="${EOS_DIR}/output"
|
|
ENV EOS_CONFIG_DIR="${EOS_DIR}/config"
|
|
|
|
# Overwrite when starting the container in a production environment
|
|
ENV EOS_SERVER__EOSDASH_SESSKEY=s3cr3t
|
|
|
|
WORKDIR ${EOS_DIR}
|
|
|
|
RUN adduser --system --group --no-create-home eos \
|
|
&& mkdir -p "${MPLCONFIGDIR}" \
|
|
&& chown eos "${MPLCONFIGDIR}" \
|
|
&& mkdir -p "${EOS_CACHE_DIR}" \
|
|
&& chown eos "${EOS_CACHE_DIR}" \
|
|
&& mkdir -p "${EOS_OUTPUT_DIR}" \
|
|
&& chown eos "${EOS_OUTPUT_DIR}" \
|
|
&& mkdir -p "${EOS_CONFIG_DIR}" \
|
|
&& chown eos "${EOS_CONFIG_DIR}"
|
|
|
|
COPY requirements.txt .
|
|
|
|
RUN --mount=type=cache,target=/root/.cache/pip \
|
|
pip install -r requirements.txt
|
|
|
|
COPY pyproject.toml .
|
|
RUN mkdir -p src && pip install -e .
|
|
|
|
COPY src src
|
|
|
|
# Create minimal default configuration for Docker to fix EOSDash accessibility (#629)
|
|
# This ensures EOSDash binds to 0.0.0.0 instead of 127.0.0.1 in containers
|
|
RUN echo '{\n\
|
|
"server": {\n\
|
|
"host": "0.0.0.0",\n\
|
|
"port": 8503,\n\
|
|
"startup_eosdash": true,\n\
|
|
"eosdash_host": "0.0.0.0",\n\
|
|
"eosdash_port": 8504\n\
|
|
}\n\
|
|
}' > "${EOS_CONFIG_DIR}/EOS.config.json" \
|
|
&& chown eos:eos "${EOS_CONFIG_DIR}/EOS.config.json"
|
|
|
|
USER eos
|
|
ENTRYPOINT []
|
|
|
|
EXPOSE 8503
|
|
EXPOSE 8504
|
|
|
|
CMD ["python", "src/akkudoktoreos/server/eos.py", "--host", "0.0.0.0"]
|
|
|
|
VOLUME ["${MPLCONFIGDIR}", "${EOS_CACHE_DIR}", "${EOS_OUTPUT_DIR}", "${EOS_CONFIG_DIR}"]
|