Skip to content

Commit

Permalink
Merge pull request #4 from th2-net/share-libs
Browse files Browse the repository at this point in the history
[th2-5208] added `${HOME}/python/lib` into `PYTHONPATH` environment v…
  • Loading branch information
molotgor authored Jun 21, 2024
2 parents a2c2aad + 5789298 commit e9f9b7e
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 6 deletions.
6 changes: 5 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,12 @@ USER json-stream
ENV HOME="/home/json-stream"
ENV PATH="${HOME}/.local/bin:${PATH}"
ENV XDG_CACHE_HOME="${HOME}/.cache"
ENV PYTHONPATH="${HOME}:/home/jovyan/.local/lib/python3.9/site-packages:/.local/lib/python3.9/site-packages:${PYTHONPATH}"
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 PIP_CONFIG_FILE="${HOME}/.pip/pip.conf"

RUN mkdir -p "${PYTHON_SHARED_LIB_PATH}"

ENTRYPOINT ["python", "/app/server.py"]
CMD ["/var/th2/config/custom.json"]
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,16 @@ docker compose up

## Release notes:

### 0.0.4

* added `${HOME}/python/lib` into `PYTHONPATH` environment variable
* update local run with jupyter-notebook:
* updated jupyter-notebook Dockerfile:
* used `jupyter/datascience-notebook:python-3.9`
* defined `PYTHONPATH`, `PIP_TARGET` environment variables
* updated compose:
* added `python_lib` volume

### 0.0.3

* Added `json-stream` user to users group
Expand Down
7 changes: 4 additions & 3 deletions local-run/with-jupyter-notebook/compose.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
services:
json_stream_provider:
build:
context: ../../
dockerfile: Dockerfile
image: ghcr.io/th2-net/th2-json-stream-provider-py:0.0.4-share-libs-9615321649-5f861c3
ports:
- "8081:8080"
volumes:
- package_volume:/opt/conda/lib/:ro
- j_sp_volume:/home/json-stream/:rw
- jupyter_volume:/home/jovyan/:rw
- python_lib:/home/json-stream/python/lib:ro
- ${USER_DATA_DIR}:/home/jovyan/user-data/:ro
- ./json-stream-provider/custom.json:/var/th2/config/custom.json:ro
networks:
Expand All @@ -23,6 +22,7 @@ services:
volumes:
- package_volume:/opt/conda/lib/:rw
- jupyter_volume:/home/jovyan/:rw
- python_lib:/home/jovyan/python/lib:rw
- ${USER_DATA_DIR}:/home/jovyan/user-data/:ro
networks:
- th2_network
Expand All @@ -47,6 +47,7 @@ volumes:
package_volume:
jupyter_volume:
j_sp_volume:
python_lib:

networks:
th2_network:
8 changes: 7 additions & 1 deletion local-run/with-jupyter-notebook/jupyter-notebook/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
FROM jupyter/datascience-notebook:python-3.9

RUN echo "c.ServerApp.base_url = '/jupyter/'" >> /etc/jupyter/jupyter_server_config.py
RUN echo "c.ServerApp.base_url = '/jupyter/'" >> /etc/jupyter/jupyter_server_config.py

ENV PYTHON_SHARED_LIB_PATH="${HOME}/python/lib"

RUN mkdir -p "${PYTHON_SHARED_LIB_PATH}"
ENV PYTHONPATH="${PYTHONPATH}:${PYTHON_SHARED_LIB_PATH}"
ENV PIP_TARGET="${PYTHON_SHARED_LIB_PATH}"
2 changes: 1 addition & 1 deletion package_info.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"package_name": "th2-json-stream-provider",
"package_version": "0.0.3"
"package_version": "0.0.4"
}

0 comments on commit e9f9b7e

Please sign in to comment.