Adding a new Docker configuration (#634)

* Adding a new docker configuration

* Updating file permissions

* Renaming to gst

* Updating the note to customize environment variables

* Updating dockerignore and docker-compose

* Typo in gst-poetry-deps
This commit is contained in:
Artem Veremey
2021-08-02 13:41:24 -07:00
committed by GitHub
parent 5337f615b9
commit 0e5a392427
13 changed files with 135 additions and 47 deletions

4
.dockerignore vendored
View File

@@ -5,3 +5,7 @@
.gitignore
docker-compose.yaml
Dockerfile*
.vscode
.idea
__pycache__
.python-version

38
Dockerfile vendored
View File

@@ -1,38 +0,0 @@
FROM python:3.6.13-slim-buster
RUN apt-get update && apt-get -y install --no-install-recommends \
gcc \
g++ \
make \
wget \
curl \
telnet \
net-tools \
iputils-ping \
dnsutils \
git \
gnupg \
unzip \
bzip2 \
libsm6 \
libxt6 \
libgl1-mesa-glx \
libpng16-16 \
python3-tk && \
apt-get -y autoremove && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN useradd --create-home --shell /bin/bash python
USER python
WORKDIR /home/python
ENV PATH="/home/python/.local/bin:${PATH}"
COPY --chown=python:python . .
#RUN INSTALL_ON_LINUX=1 pip install -r requirements.txt
RUN pip install "poetry==1.1.4"
RUN poetry export --without-hashes -f requirements.txt | pip install -r /dev/stdin
CMD ["python", "terminal.py"]

17
README.md vendored
View File

@@ -195,10 +195,21 @@ poetry install -E prediction
*If you would like to set up a docker image:*
* Build the docker: `docker build .`
* Run it: `docker run -it gamestonkterminal:dev `
* Build the docker:
Note: The problem with docker is that it won't output matplotlib figures.
```
docker-compose -f docker/docker-compose.yaml build gst-python
docker-compose -f docker/docker-compose.yaml build gst-poetry-deps
docker-compose -f docker/docker-compose.yaml build gst-poetry
```
* Run it:
```
docker run -it --env-file=docker/setenv --rm gst/gst-poetry:1.1.0
```
Note: Remember to customize your docker/setenv.
### Update Terminal

6
docker-compose.yaml vendored
View File

@@ -1,6 +0,0 @@
version: '3.8'
services:
gamestonkterminal:
build:
context: .
image: gamestonkterminal:dev

31
docker/docker-compose.yaml vendored Normal file
View File

@@ -0,0 +1,31 @@
version: '3.8'
services:
gst-python:
build:
context: ..
dockerfile: docker/gst-python.dockerfile
image: gst/gst-python:1.0.0
gst-deps:
build:
context: ..
dockerfile: docker/gst-deps.dockerfile
image: gst/gst-deps:1.0.0
gst-poetry-deps:
build:
context: ..
dockerfile: docker/gst-poetry-deps.dockerfile
image: gst/gst-poetry-deps:1.0.0
gst:
build:
context: ..
dockerfile: docker/gst.dockerfile
image: gst/gst:1.1.0
tty: true
env_file: setenv
gst-poetry:
build:
context: ..
dockerfile: docker/gst-poetry.dockerfile
image: gst/gst-poetry:1.1.0
tty: true
env_file: setenv

4
docker/entry-point-poetry.sh vendored Normal file
View File

@@ -0,0 +1,4 @@
#!/bin/bash
# stty erase ^h
poetry run python terminal.py

5
docker/entry-point.sh vendored Normal file
View File

@@ -0,0 +1,5 @@
#!/bin/bash
# stty erase ^h
# poetry run python terminal.py
python terminal.py

5
docker/gst-deps.dockerfile vendored Normal file
View File

@@ -0,0 +1,5 @@
FROM gst/gst-python:1.0.0
COPY --chown=python:python requirements.txt /home/python/
RUN pip install -r requirements.txt

8
docker/gst-poetry-deps.dockerfile vendored Normal file
View File

@@ -0,0 +1,8 @@
FROM gst/gst-python:1.0.0
COPY --chown=python:python pyproject.toml poetry.lock /home/python/
RUN mkdir /home/python/gamestonk_terminal && \
touch gamestonk_terminal/__init__.py && \
chown python:python /home/python/gamestonk_terminal /home/python/gamestonk_terminal/__init__.py && \
poetry install

5
docker/gst-poetry.dockerfile vendored Normal file
View File

@@ -0,0 +1,5 @@
FROM gst/gst-poetry-deps:1.0.0
COPY --chown=python:python . .
CMD ["bash", "docker/entry-point-poetry.sh"]

33
docker/gst-python.dockerfile vendored Normal file
View File

@@ -0,0 +1,33 @@
FROM python:3.8-slim-buster
RUN apt-get update && apt-get -y install --no-install-recommends \
gcc \
g++ \
make \
wget \
curl \
telnet \
net-tools \
iputils-ping \
dnsutils \
git \
gnupg \
unzip \
bzip2 \
libsm6 \
libxt6 \
libgl1-mesa-glx \
libpng16-16 \
python3-tk && \
apt-get -y autoremove && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN useradd --create-home --shell /bin/bash python
USER python
WORKDIR /home/python
ENV PATH="/home/python/.local/bin:${PATH}"
RUN pip install "poetry==1.1.7"

5
docker/gst.dockerfile vendored Normal file
View File

@@ -0,0 +1,5 @@
FROM gst/gst-deps:1.0.0
COPY --chown=python:python . .
CMD ["bash", "docker/entry-point.sh"]

21
docker/setenv vendored Normal file
View File

@@ -0,0 +1,21 @@
DISPLAY="ADDRESS-OF-YOUR-XSERVER"
GT_API_KEY_FINANCIALMODELINGPREP="YOUR_KEY"
GT_API_REDDIT_CLIENT_ID="YOUR_KEY"
GT_API_REDDIT_CLIENT_SECRET="YOUR_KEY"
GT_API_REDDIT_USERNAME="YOUR_KEY"
GT_API_REDDIT_USER_AGENT=Python
GT_API_REDDIT_PASSWORD="YOUR_KEY"
GT_API_TWITTER_KEY="YOUR_KEY"
GT_API_TWITTER_SECRET_KEY="YOUR_KEY"
GT_FRED_API_KEY="YOUR_KEY"
HDF5_DISABLE_VERSION_CHECK=2
GTFF_ENABLE_PREDICT=True
GTFF_ENABLE_THOUGHTS_DAY=False
GTFF_USE_PROMPT_TOOLKIT=True
GTFF_USE_ION=True