diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 000000000..2735306c5 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,35 @@ +FROM python:3.9 + +ARG CODE_SERVER_VERSION=2.1692-vsc1.39.2 +ENV CODE_SERVER_AUTH=none \ + CODE_SERVER_PASSWORD=feathr \ + JUPYTER_TOKEN=feathr + +# install enssential libs +RUN apt-get update && \ + apt-get install -y \ + wget curl git cmake + + +# install useful tools: sshd, jupyterlab and so on... +RUN apt-get update && \ + apt-get install -y supervisor vim sudo zip unzip htop && \ + pip install --no-cache-dir jupyterlab==0.35.4 pandavro + +RUN mkdir /feathr +WORKDIR /feathr +RUN pip install git+https://github.com/linkedin/feathr.git#subdirectory=feathr_project + +# install code-server +RUN mkdir -p /opt/code-server && \ + wget -qO- https://github.com/cdr/code-server/releases/download/${CODE_SERVER_VERSION}/code-server${CODE_SERVER_VERSION}-linux-x86_64.tar.gz | tar -xzf - --strip=1 -C /opt/code-server + + +# copy supervisord configuration and mkdir +COPY supervisord.conf /opt/supervisord.conf +RUN mkdir -p /opt/logs + +# 8080: VsCode, 9090: jupyter +EXPOSE 8080 9090 + +CMD ["supervisord", "-c", "/opt/supervisord.conf"] \ No newline at end of file diff --git a/docker/supervisord.conf b/docker/supervisord.conf new file mode 100644 index 000000000..8550a8ca1 --- /dev/null +++ b/docker/supervisord.conf @@ -0,0 +1,39 @@ +[unix_http_server] +file=/var/run/supervisor.sock ; (the path to the socket file) +chmod=0700 ; sockef file mode (default 0700) + +[supervisorctl] +serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket + +[supervisord] +pidfile=/var/run/supervisord.log +logfile=/opt/logs/supervisord.log +logfile_maxbytes=256MB +logfile_backups=8 +loglevel=info +nodaemon=true + +[program:jupyter] +directory=/ +command=jupyter lab --ip 0.0.0.0 --port 9090 --allow-root --LabApp.token=%(ENV_JUPYTER_TOKEN)s +stdout_logfile=/opt/logs/jupyter.log +autostart=true +autorestart=true +startsecs=1 +startretries=3 +stopasgroup=true +killasgroup=true +priority=1001 + +[program:codeserver] +directory=/ +environment=PASSWORD="%(ENV_CODE_SERVER_PASSWORD)s" +command=/opt/code-server/code-server --host 0.0.0.0 --port 8080 --auth %(ENV_CODE_SERVER_AUTH)s +stdout_logfile=/opt/logs/code-server.log +autostart=true +autorestart=true +startsecs=1 +startretries=3 +stopasgroup=true +killasgroup=true +priority=1002 \ No newline at end of file diff --git a/docs/dev_guide/images/docker_port_mapping.png b/docs/dev_guide/images/docker_port_mapping.png new file mode 100644 index 000000000..35951c0b9 Binary files /dev/null and b/docs/dev_guide/images/docker_port_mapping.png differ diff --git a/docs/dev_guide/images/jupyterlab_browser.png b/docs/dev_guide/images/jupyterlab_browser.png new file mode 100644 index 000000000..004162422 Binary files /dev/null and b/docs/dev_guide/images/jupyterlab_browser.png differ diff --git a/docs/dev_guide/images/vscode_browser.png b/docs/dev_guide/images/vscode_browser.png new file mode 100644 index 000000000..a340f49f0 Binary files /dev/null and b/docs/dev_guide/images/vscode_browser.png differ diff --git a/docs/dev_guide/python_dev_guide.md b/docs/dev_guide/python_dev_guide.md index 73bc649ba..54e43f9fc 100644 --- a/docs/dev_guide/python_dev_guide.md +++ b/docs/dev_guide/python_dev_guide.md @@ -31,6 +31,25 @@ We use [Google Python Style Guide](https://google.github.io/styleguide/pyguide.h Run `pytest` in this folder to kick off the integration test. The integration test will test the creation of feature dataset, the materialization to online storage, and retrieve from online storage, as well as the CLI. It usually takes 5 ~ 10 minutes. It needs certain keys for cloud resources. +## Using Docker + +We provide a dockerfile with feathr installed, and with embedded vscode server, and jupyter lab. +To build the docker, navigate to Feathr root folder, and use following command to build a docker file: +`docker build -t docker` + +Run the docker image with port mapping. +![dockerportmapping](./images/docker_port_mapping.png) + + +8080 : VsCode (default password is 'feathr') + +9090: Jupyter Lab (default password is 'feathr') + +With the docker image running, open your browser and access +`localhost:` to access apps. +![codeserver](./images/vscode_browser.png) +![jupyterlab](./images/jupyterlab_browser.png) + ## Using Virtual Environment