From b6ffd887926e5d89caffbf09fffbd1bf1102b618 Mon Sep 17 00:00:00 2001 From: Juan Vanegas Date: Wed, 12 Jun 2024 15:50:08 -0500 Subject: [PATCH 1/6] Local docker environment setup --- Dockerfile | 13 +++++++++++++ README.md | 19 +++++++++++++++++++ docker-compose.yaml | 9 +++++++++ 3 files changed, 41 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yaml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..52eadd3 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM continuumio/miniconda3 + +WORKDIR /workshop + +RUN /opt/conda/bin/conda install jupyter + +COPY environment.yml . +RUN /opt/conda/bin/conda env create --file environment.yml + +COPY . . + +# Run within the container and allow access without token from localhost:8888 +CMD [ "conda", "run", "-n", "data_viz_workshop", "jupyter", "lab", "--allow-root", "--ip=0.0.0.0", "--no-browser", "--NotebookApp.token=''" ] diff --git a/README.md b/README.md index ca4f342..a1163a1 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,25 @@ You can work through the notebooks locally or in your browser. Pick the installa ![check env](./media/env_check.png) +### Docker installation +If you have Docker installed in your system (instructions [here](https://docs.docker.com/get-docker/)) you can set up the environment using `docker compose`. Run through the [Local Installation](#local-installation) guide, but instead of steps 4 and 5, do + +4. Build the Docker image needed to run the Jupyter environment: + + ```shell + docker compose build + ``` + +5. Launch JupyterLab from within Docker: + + ```shell + docker compose up + ``` + +You should be able to access the environment at [http://localhost:8888](http://localhost:8888). Follow through steps 6-7 normally. + +*Note: to terminate the Docker service once you're done, use `ctr+c` to terminate the command.* + ### Cloud Options #### GitHub Codespaces diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..1c1488c --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,9 @@ +version: '3.8' + +services: + workshop: + build: . + ports: + - "8888:8888" + volumes: + - .:/workshop \ No newline at end of file From 2137261d2079f21d6e5c1200623831b192ad37a5 Mon Sep 17 00:00:00 2001 From: Juan Vanegas Date: Wed, 12 Jun 2024 15:58:00 -0500 Subject: [PATCH 2/6] Fix README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a1163a1..f9ed57d 100644 --- a/README.md +++ b/README.md @@ -81,7 +81,7 @@ You can work through the notebooks locally or in your browser. Pick the installa ![check env](./media/env_check.png) ### Docker installation -If you have Docker installed in your system (instructions [here](https://docs.docker.com/get-docker/)) you can set up the environment using `docker compose`. Run through the [Local Installation](#local-installation) guide, but instead of steps 4 and 5, do +If you have Docker installed in your system (instructions [here](https://docs.docker.com/get-docker/)), you can set up the environment using `docker compose`. Run through the [local installation guide](#local-installation) (skip installing anaconda in step 0, as Docker takes care of installing this dependency), and instead of steps 4 and 5, do 4. Build the Docker image needed to run the Jupyter environment: From 0768795e64325b132e0a4d75b83ade6ac5936d34 Mon Sep 17 00:00:00 2001 From: Juan Vanegas Date: Tue, 23 Jul 2024 18:34:01 -0500 Subject: [PATCH 3/6] Refactor Dockerfile CMD for better readability --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 52eadd3..31940e7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,4 +10,5 @@ RUN /opt/conda/bin/conda env create --file environment.yml COPY . . # Run within the container and allow access without token from localhost:8888 -CMD [ "conda", "run", "-n", "data_viz_workshop", "jupyter", "lab", "--allow-root", "--ip=0.0.0.0", "--no-browser", "--NotebookApp.token=''" ] +CMD [ "conda", "run", "-n", "data_viz_workshop", "jupyter", "lab", \ + "--allow-root", "--ip=0.0.0.0", "--no-browser", "--NotebookApp.token=''" ] From 4ff005a3cee86d92123fb7f84dc12bbd01be290d Mon Sep 17 00:00:00 2001 From: Juan Vanegas Date: Tue, 23 Jul 2024 18:34:15 -0500 Subject: [PATCH 4/6] Update docker-compose.yaml file --- docker-compose.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 1c1488c..426d0ed 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,9 +1,7 @@ -version: '3.8' - services: workshop: build: . ports: - "8888:8888" volumes: - - .:/workshop \ No newline at end of file + - .:/workshop From e2a720f5c48263b441f655ba360d67f4e2f2770d Mon Sep 17 00:00:00 2001 From: Juan Vanegas Date: Tue, 23 Jul 2024 18:34:53 -0500 Subject: [PATCH 5/6] Update Docker installation instructions in README.md --- README.md | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index f9ed57d..7f867e1 100644 --- a/README.md +++ b/README.md @@ -80,24 +80,47 @@ You can work through the notebooks locally or in your browser. Pick the installa ![check env](./media/env_check.png) -### Docker installation -If you have Docker installed in your system (instructions [here](https://docs.docker.com/get-docker/)), you can set up the environment using `docker compose`. Run through the [local installation guide](#local-installation) (skip installing anaconda in step 0, as Docker takes care of installing this dependency), and instead of steps 4 and 5, do +### Docker Installation +0. Install the following, if not already installed: + - [Docker](https://docs.docker.com/get-docker/) + - [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) + +1. Fork this repository: + + ![location of fork button in GitHub](./media/fork_button.png) + +2. Navigate to your fork, and click the **Code** button: + + ![location of code button in GitHub](./media/code_button.png) + +3. Clone your forked repository using the desired method from the **Local** tab: + + local cloning options 4. Build the Docker image needed to run the Jupyter environment: ```shell - docker compose build + $ cd python-data-viz-workshop + ~/python-data-viz-workshop$ docker compose build ``` -5. Launch JupyterLab from within Docker: +5. Launch JupyterLab from within a Docker container: ```shell - docker compose up + ~/python-data-viz-workshop$ docker compose up ``` -You should be able to access the environment at [http://localhost:8888](http://localhost:8888). Follow through steps 6-7 normally. + You should be able to access the environment at + +6. Navigate to the `0-check_your_env.ipynb` notebook in the `notebooks/` folder: + + ![open 0-check_your_env.ipynb](./media/open_env_check_notebook.png) + +7. Run the notebook to confirm everything is set up properly: + + ![check env](./media/env_check.png) -*Note: to terminate the Docker service once you're done, use `ctr+c` to terminate the command.* +*Note: Once you're done, use `ctrl+c` to stop the Docker container.* ### Cloud Options From 98a6adbf0b961e698f4c1ac0167efcff25398516 Mon Sep 17 00:00:00 2001 From: Juan Vanegas Date: Sat, 27 Jul 2024 15:32:02 -0500 Subject: [PATCH 6/6] Fix Docker command alignment --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 31940e7..d0d52aa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,4 +11,4 @@ COPY . . # Run within the container and allow access without token from localhost:8888 CMD [ "conda", "run", "-n", "data_viz_workshop", "jupyter", "lab", \ - "--allow-root", "--ip=0.0.0.0", "--no-browser", "--NotebookApp.token=''" ] + "--allow-root", "--ip=0.0.0.0", "--no-browser", "--NotebookApp.token=''" ]