Skip to content

Commit

Permalink
[th2-5208] corrected Dockerfile
Browse files Browse the repository at this point in the history
* created and provided read access to /app/var/th2/config/ folder
* corrected PYTHONPATH
  • Loading branch information
Nikita-Smirnov-Exactpro committed Jun 26, 2024
1 parent d60fba0 commit 9d88bee
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
13 changes: 7 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,23 @@ COPY . /app
# usermod --append - append the user to the supplemental GROUPS mentioned by the -G/--groups option without removing the user from other groups
# usermod --groups - new list of supplementary GROUPS
RUN groupadd --system json-stream && useradd --system --gid json-stream --uid 1000 json-stream && usermod --append --groups users json-stream
ENV HOME="/home/json-stream"
RUN mkdir -p "${HOME}"

ENV TH2_CFG_DIR="/app/var/th2/config/"
ENV HOME="/home/json-stream"
ENV PATH="${HOME}/.local/bin:${PATH}"
ENV XDG_CACHE_HOME="${HOME}/.cache"
ENV PYTHONPATH="${HOME}/.local/lib/python3.9/site-packages:${PYTHONPATH}"
ENV PIP_CONFIG_FILE="${HOME}/.pip/pip.conf"
ENV PYTHONPATH="${PYTHONPATH}:/opt/conda/lib/python3.9/site-packages"
ENV PYTHONPATH="${HOME}/.local/lib/python3.9/site-packages:/opt/conda/lib/python3.9/site-packages"

RUN mkdir -p "${HOME}" "${TH2_CFG_DIR}"

# Install any needed dependencies specified in requirements.txt
RUN pip install -r requirements.txt
RUN ipython kernel install --name "python3" --user
# Run server.py when the container launches \

RUN chown -R json-stream "${HOME}" && chmod -R g=u "${HOME}"
RUN chown -R json-stream "${HOME}" && chmod -R g=u "${HOME}" \
&& chown -R json-stream "${TH2_CFG_DIR}" && chmod -R g=u "${TH2_CFG_DIR}"

USER json-stream

Expand All @@ -36,7 +37,7 @@ ENV PATH="${HOME}/.local/bin:${PATH}"
ENV XDG_CACHE_HOME="${HOME}/.cache"
ENV PYTHON_SHARED_LIB_PATH="${HOME}/python/lib"
ENV PYTHON_LOCAL_LIB_PATH="${HOME}/.local/lib/python3.9/site-packages"
ENV PYTHONPATH="${PYTHONPATH}:${PYTHON_LOCAL_LIB_PATH}:${PYTHON_LOCAL_LIB_PATH}"
ENV PYTHONPATH="${PYTHONPATH}:${PYTHON_LOCAL_LIB_PATH}:${PYTHON_SHARED_LIB_PATH}"
ENV PIP_CONFIG_FILE="${HOME}/.pip/pip.conf"

RUN mkdir -p "${PYTHON_SHARED_LIB_PATH}"
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,13 @@ Or change the `local-run/with-jupyter-notebook/compose.yml` file. Please note yo
cd local-run/with-jupyter-notebook
docker compose up
```
#### clean command
```shell
cd local-run/with-jupyter-notebook
docker compose rm --force --volumes --stop
docker compose down --volumes
docker compose build
```
#### application URLs:
* http://localhost - th2-rpt-viewer
* http://localhost/jupyter - jupyter-notebook. You can authorise via token printed into `jupyter_notebook` logs:
Expand Down

0 comments on commit 9d88bee

Please sign in to comment.