Skip to content

Commit

Permalink
docker configuration and instructions - CPU edition
Browse files Browse the repository at this point in the history
  • Loading branch information
signalprime committed Jan 7, 2020
1 parent c816e89 commit 99f049a
Show file tree
Hide file tree
Showing 12 changed files with 136 additions and 0 deletions.
43 changes: 43 additions & 0 deletions docker/cpu/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
FROM debian:stretch

# Install git, supervisor, VNC, & X11 packages
RUN set -ex; \
apt-get update; \
apt-get install -y \
bash \
fluxbox \
git \
net-tools \
novnc \
supervisor \
x11vnc \
xterm \
xvfb \
vim \
python3 \
python3-tk \
python3-pip \
lsof \
git \
libsm6 \
libxext6 \
libxrender-dev \
byobu \
chromium

RUN python3 -m pip install tornado tensorflow==1.12.0 opencv-python==3.4.4.19 gym==0.10.11 backtrader==1.9.74.123 pyzmq==17.1.2 matplotlib==2.0.2 pillow numpy==1.16.4 scipy==1.3.0 pandas==0.23.4 ipython==7.2.0 psutil==5.4.8 logbook==1.4.1 jupyter jupyter_http_over_ws>=0.0.1a3

# Setup demo environment variables
ENV HOME=/root \
DEBIAN_FRONTEND=noninteractive \
LANG=en_US.UTF-8 \
LANGUAGE=en_US.UTF-8 \
LC_ALL=C.UTF-8 \
DISPLAY=:0.0 \
DISPLAY_WIDTH=1800 \
DISPLAY_HEIGHT=900 \
RUN_XTERM=yes \
RUN_FLUXBOX=yes
COPY . /app
CMD ["/app/entrypoint.sh"]
EXPOSE 8888 8080 6007
23 changes: 23 additions & 0 deletions docker/cpu/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# btgym docker for CPU only

## To Build
- sudo docker image build -t btgym .

## To Run
- docker container run -p 8080:8080 -p 6006:6006 -p 8888:8888 btgym

### To link local directory
- add "-v /local_dir:/container_dir"

### To use your own copy of btgym
- comment out the following line in entrypoint.sh
exec git clone https://github.com/Kismuz/btgym.git /workspace &

## Notes
The container starts with chromium opening the jupyter nootbook authorization, select the file nbserver-#-open.html to access the notbook server.

##### Original credits to:
- https://github.com/theasp/docker

##### Which was based on:
- https://github.com/psharkey/docker/tree/master/novnc
3 changes: 3 additions & 0 deletions docker/cpu/conf.d/chromium.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[program:chromium]
command=chromium --no-sandbox file:///root/.local/share/jupyter/runtime/ > /dev/null
autorestart=true
3 changes: 3 additions & 0 deletions docker/cpu/conf.d/fluxbox.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[program:fluxbox]
command=fluxbox
autorestart=true
3 changes: 3 additions & 0 deletions docker/cpu/conf.d/jupyter.conf.not_working
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[program:jupyter]
command=jupyter notebook --notebook-dir=/workspace/ --ip 0.0.0.0 --allow-root --NotebookApp.allow_origin='https://colab.research.google.com' --port=8888 --NotebookApp.port_retries=0
autorestart=true
3 changes: 3 additions & 0 deletions docker/cpu/conf.d/websockify.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[program:websockify]
command=websockify --web /usr/share/novnc 8080 localhost:5900
autorestart=true
3 changes: 3 additions & 0 deletions docker/cpu/conf.d/x11vnc.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[program:x11vnc]
command=x11vnc -forever -shared
autorestart=true
3 changes: 3 additions & 0 deletions docker/cpu/conf.d/xterm.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[program:xterm]
command=xterm
autorestart=true
3 changes: 3 additions & 0 deletions docker/cpu/conf.d/xvfb.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[program:xvfb]
command=Xvfb :0 -screen 0 "%(ENV_DISPLAY_WIDTH)s"x"%(ENV_DISPLAY_HEIGHT)s"x24 -listen tcp -ac
autorestart=true
22 changes: 22 additions & 0 deletions docker/cpu/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: '2'
services:
ide:
image: psharkey/intellij:latest
environment:
- DISPLAY=novnc:0.0
depends_on:
- novnc
networks:
- x11
novnc:
image: theasp/novnc:latest
environment:
# Adjust to your screen size
- DISPLAY_WIDTH=1600
- DISPLAY_HEIGHT=968
ports:
- "8080:8080"
networks:
- x11
networks:
x11:
22 changes: 22 additions & 0 deletions docker/cpu/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash
set -ex

RUN_FLUXBOX=${RUN_FLUXBOX:-yes}
RUN_XTERM=${RUN_XTERM:-yes}

case $RUN_FLUXBOX in
false|no|n|0)
rm -f /app/conf.d/fluxbox.conf
;;
esac

case $RUN_XTERM in
false|no|n|0)
rm -f /app/conf.d/xterm.conf
;;
esac
exec git clone https://github.com/Kismuz/btgym.git /workspace &
exec jupyter serverextension enable --py jupyter_http_over_ws &
exec tensorboard --logdir=/workspace/btgym/logdir &
exec jupyter notebook --notebook-dir=/workspace/ --ip 0.0.0.0 --allow-root --NotebookApp.allow_origin='https://colab.research.google.com' --port=8888 --NotebookApp.port_retries=0 &
exec supervisord -c /app/supervisord.conf
5 changes: 5 additions & 0 deletions docker/cpu/supervisord.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[supervisord]
nodaemon=true

[include]
files = /app/conf.d/*.conf

0 comments on commit 99f049a

Please sign in to comment.