Skip to content

Commit b8afb52

Browse files
committed
fix docker issue
1 parent e44865a commit b8afb52

File tree

4 files changed

+24
-14
lines changed

4 files changed

+24
-14
lines changed

.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
notebook
1+
notebook/
22
.vscode
33
mrn_python
44
.gitignore

Dockerfile

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,25 @@
1-
FROM python:3.7-alpine
1+
#Build stage, using slim based-image because alpine cannot use Pandas and Matplotlib
2+
FROM python:3.8.11-slim AS builder
23

34
LABEL maintainer="Wasin Waeosri <wasin.waeosri@rifinitiv.com>"
4-
LABEL build_date="2021-05-18"
5-
# set working directory
6-
WORKDIR /app
75

8-
# Copy requirements.txt first
6+
#Copy requirements.txt
97
COPY requirements.txt .
10-
# instruction to be run during image build
11-
RUN pip install -r requirements.txt
128

13-
# then copy the application
9+
# install dependencies to the local user directory (eg. /root/.local)
10+
RUN pip install --user -r requirements.txt
11+
12+
# Run stage, using slim based-image because alpine cannot use Pandas and Matplotlib
13+
FROM python:3.8.11-alpine
14+
WORKDIR /app
15+
16+
# Update PATH environment variable + set Python buffer to make Docker print every message instantly.
17+
ENV PATH=/root/.local:$PATH \
18+
PYTHONUNBUFFERED=1
19+
20+
# copy only the dependencies installation from the 1st stage image
21+
COPY --from=builder /root/.local /root/.local
1422
COPY mrn_console_app.py .
1523

24+
#Run Python
1625
ENTRYPOINT ["python", "./mrn_console_app.py"]

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# WebSocket API Machine Readable News Example with Python
2-
- Last update: May 2021
2+
- Last update: September 2021
33
- Environment: Windows and Linux OS
44
- Compiler: Python
55
- Prerequisite: Refinitiv Real-Time Advanced Data Hub and Refinitiv Real-Time Advanced Distribution servers version 3.2.1 and above, MRN service
@@ -59,7 +59,7 @@ This example requires the following dependencies software and libraries.
5959
6. [Docker Engine - Community Edition](https://docs.docker.com/install/) (for running a console example in Docker only)
6060

6161
*Note:*
62-
- The Python example has been qualified with Python versions 3.6.5 and Python 3.7.4 (Docker 19.03.1 - CentOS 7)
62+
- The Python example has been qualified with Python versions 3.6.5, Python 3.7.4 and Python 3.8.x (Docker 19.03.1 - CentOS 7)
6363
- Please refer to the [pip installation guide page](https://pip.pypa.io/en/stable/installing/) if your environment does not have the [pip tool](https://pypi.org/project/pip/) installed.
6464
- If your environment already have a websocket-client library installed, you can use ```pip list``` command to verify a library version, then use ```pip install --upgrade websocket-client``` command to upgrade websocket-client library.
6565
- It is not advisable to change the Refinitiv Real-Time Distribution System configuration if you are not familiar with the configuration procedures. Please consult your Market Data administrator for any questions regarding Refinitiv Real-Time Distribution System-MRN service configuration.
@@ -95,9 +95,10 @@ Optionally, the application subscribes ```MRN_STORY``` RIC code from Real-Time A
9595
```
9696
3. Once the build is a success, you can create and run the container with the following command
9797
```
98-
$> docker run rtsdk_ws_mrn_python --hostname Real-Time Advanced Distribution Server IP Address/Hostname> --port <WebSocket Port> --ric <MRN RIC name>
98+
$> docker run --name mrn_console -it rtsdk_ws_mrn_python --hostname Real-Time Advanced Distribution Server IP Address/Hostname> --port <WebSocket Port> --ric <MRN RIC name>
9999
```
100100
4. If you want to connect the Docker container to a localhost, please use ```host.docker.internal``` as the Host name.
101+
5. Press Ctrl+C buttons to stop the application
101102
102103
### Classic Jupyter Notebook example
103104
@@ -106,7 +107,7 @@ Please be informed that Python [Anaconda](https://www.anaconda.com/distribution
106107
1. Open Anaconda Prompt and go to the project's folder
107108
2. Run the following command in an Anaconda Prompt to create a Conda environment named *mrn_python_notebook* for the project.
108109
```
109-
(base) $>conda create --name mrn_python_notebook python=3.7
110+
(base) $>conda create --name mrn_python_notebook python=3.8
110111
```
111112
3. Once the environment is created, activate Conda environment named ```mrn_python_notebook``` with this command in Anaconda Prompt
112113
```

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pylint==2.6.0
1212
requests==2.25.1
1313
six==1.12.0
1414
toml==0.10.1
15-
typed-ast==1.4.1
15+
typed-ast==1.4.3
1616
urllib3>=1.25.8
1717
websocket-client==0.56.0
1818
wrapt==1.12.1

0 commit comments

Comments
 (0)