mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2025-08-26 15:31:14 +00:00
Streamline Dockerfile, remove unused deps
* Dockerfile: Use non-root user, buildx cache, setup for readonly container, remove unused apt deps. For now don't install pip package and keep development flask server as this will be replaced in the future (fastapi). Then a proper webserver (e.g. nginx) should be used and the pip package can be created and deployed just to the run-stage (with the webserver). * docker-compose: Set to readonly (anonymous volumes declared in Dockerfile should maintain all writable data). Mount config.py for easier development. Should be replaced by environment support for all config file variables. * Remove unused runtime dependencies: mariadb, joblib, pytest, pytest-cov. * Move pytest-cov to dev dependencies. * Add output_dir to config.py. * Fix visualization_results.pdf endpoint. * Update docs.
This commit is contained in:
committed by
Andreas
parent
59dcf8c459
commit
b620250536
36
Dockerfile
36
Dockerfile
@@ -3,23 +3,33 @@ FROM python:${PYTHON_VERSION}-slim
|
||||
|
||||
LABEL source="https://github.com/Akkudoktor-EOS/EOS"
|
||||
|
||||
EXPOSE 5000
|
||||
ENV VIRTUAL_ENV="/opt/venv"
|
||||
ENV PATH="${VIRTUAL_ENV}/bin:${PATH}"
|
||||
ENV MPLCONFIGDIR="/tmp/mplconfigdir"
|
||||
ENV EOS_DIR="/opt/eos"
|
||||
ENV EOS_CACHE_DIR="${EOS_DIR}/cache"
|
||||
ENV EOS_OUTPUT_DIR="${EOS_DIR}/output"
|
||||
|
||||
WORKDIR /opt/eos
|
||||
WORKDIR ${EOS_DIR}
|
||||
|
||||
COPY . .
|
||||
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}"
|
||||
|
||||
ARG APT_OPTS="--yes --auto-remove --no-install-recommends --no-install-suggests"
|
||||
COPY requirements.txt .
|
||||
|
||||
RUN DEBIAN_FRONTEND=noninteractive \
|
||||
apt-get update \
|
||||
&& apt-get install ${APT_OPTS} gcc libhdf5-dev libmariadb-dev pkg-config mariadb-common libmariadb3 \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& pip install --no-cache-dir -r requirements.txt \
|
||||
&& pip install --no-cache-dir build \
|
||||
&& pip install --no-cache-dir -e . \
|
||||
&& apt remove ${APT_OPTS} gcc libhdf5-dev libmariadb-dev pkg-config
|
||||
RUN --mount=type=cache,target=/root/.cache/pip \
|
||||
pip install -r requirements.txt
|
||||
|
||||
COPY src .
|
||||
|
||||
USER eos
|
||||
ENTRYPOINT []
|
||||
|
||||
CMD ["python", "-m", "akkudoktoreos.flask_server"]
|
||||
CMD ["python", "-m", "akkudoktoreosserver.flask_server"]
|
||||
|
||||
VOLUME ["${MPLCONFIGDIR}", "${EOS_CACHE_DIR}", "${EOS_OUTPUT_DIR}"]
|
||||
|
Reference in New Issue
Block a user