From d6152bd853ad4ff2e337ade09972de5c0735c506 Mon Sep 17 00:00:00 2001 From: Kevin Knights Date: Wed, 2 Aug 2023 06:49:33 -0500 Subject: [PATCH 1/4] added .gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ac81c6c --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.ipynb_checkpoints/ +**/.ipynb_checkpoints/ \ No newline at end of file From 7e49304fd0fed8a03f8ae69f50188ce88615c80b Mon Sep 17 00:00:00 2001 From: Kevin Knights Date: Wed, 2 Aug 2023 06:50:12 -0500 Subject: [PATCH 2/4] added docker files to create jupyterlab container --- .dockerignore | 3 +++ Dockerfile | 57 ++++++++++++++++++++++++++++++++++++++++++++++ docker-compose.yml | 11 +++++++++ 3 files changed, 71 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..fd51f97 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +Dockerfile +docker-compose.yml +overrides.json \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b4f819a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,57 @@ +# Sources: +# https://jupyter-docker-stacks.readthedocs.io/en/latest/using/selecting.html +# https://jupyter-docker-stacks.readthedocs.io/en/latest/using/recipes.html#using-mamba-install-or-pip-install-in-a-child-docker-image +FROM jupyter/scipy-notebook:latest +LABEL authors="Kevin Knights | kevinknights29" + +ENV LANG=C.UTF-8 + +# Enable JupyterLab +ENV JUPYTER_ENABLE_LAB=yes + +# Switch to root to install packages +USER root + +# Upgrade pip +RUN python -m pip install --upgrade pip && \ + fix-permissions "${CONDA_DIR}" && \ + fix-permissions "/home/${NB_USER}" + +# Install system packages +RUN apt-get update \ + && apt-get install --no-install-recommends -y \ + # deps for building python deps + build-essential \ + python3-dev \ + gcc + +# Extensions for JupyterLab can be found: https://jupyterlab-contrib.github.io/migrate_from_classical.html +# Install JupyterLab LSP extension +RUN pip install --no-cache-dir jupyterlab-lsp 'python-lsp-server[all]' && \ + fix-permissions "${CONDA_DIR}" && \ + fix-permissions "/home/${NB_USER}" + +# Install JupyterLab Code Formatter extension +RUN pip install --no-cache-dir jupyterlab-code-formatter black isort && \ + fix-permissions "${CONDA_DIR}" && \ + fix-permissions "/home/${NB_USER}" + +# Install JupyterLab Execute Time extension +RUN pip install --no-cache-dir jupyterlab_execute_time && \ + fix-permissions "${CONDA_DIR}" && \ + fix-permissions "/home/${NB_USER}" + +# Install JupyterLab Spell Checker extension +RUN pip install --no-cache-dir jupyterlab-spellchecker && \ + fix-permissions "${CONDA_DIR}" && \ + fix-permissions "/home/${NB_USER}" + +# Adding theme configuration to JupyterLab (Dark Theme) +COPY ./overrides.json /opt/conda/share/jupyter/lab/settings/overrides.json + +# Uncomment if you need to pass requirements.txt +# # Install from the requirements.txt file +# COPY --chown=${NB_UID}:${NB_GID} requirements.txt /tmp/ +# RUN pip install --no-cache-dir --requirement /tmp/requirements.txt && \ +# fix-permissions "${CONDA_DIR}" && \ +# fix-permissions "/home/${NB_USER}" \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..3a4d003 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,11 @@ +version: '3.9' +services: + jupyter-lab: + build: + context: . + dockerfile: Dockerfile + volumes: + - .:/home/jovyan/work/ + ports: + - "8888:8888" + container_name: jupyter-lab-container \ No newline at end of file From 12bb6a3856176d55934080ebdea9680497073b8c Mon Sep 17 00:00:00 2001 From: Kevin Knights Date: Wed, 2 Aug 2023 06:50:39 -0500 Subject: [PATCH 3/4] added jupyter lab UI theme settings --- overrides.json | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 overrides.json diff --git a/overrides.json b/overrides.json new file mode 100644 index 0000000..ebc45f2 --- /dev/null +++ b/overrides.json @@ -0,0 +1,5 @@ +{ + "@jupyterlab/apputils-extension:themes": { + "theme": "JupyterLab Dark" + } +} \ No newline at end of file From 1ff10495377297641dc4292a3afa883f1c99d800 Mon Sep 17 00:00:00 2001 From: Kevin Knights Date: Wed, 2 Aug 2023 19:03:23 -0500 Subject: [PATCH 4/4] added docker instructions to README --- README.md | 45 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 71dea9b..940bb82 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,48 @@ # Python for Algorithms, Data-Structures, and Interviews! -#### Welcome to the repository for the Udemy Course: Python for Algorithms, Data Structures, and Interviews! + +## Welcome to the repository for the Udemy Course: Python for Algorithms, Data Structures, and Interviews! This is the ultimate course in preparing you for your technical interviews and landing the job of your dreams! -Get the entire course, including full video content, solution walkthroughs, discussion forums, instructor support, -and much more for only $20 by using the [discount link](https://www.udemy.com/python-for-data-structures-algorithms-and-interviews/?couponCode=github_discount)! +Get the entire course, including full video content, solution walkthroughs, discussion forums, instructor support, and much more for only $20 by using the [discount link](https://www.udemy.com/python-for-data-structures-algorithms-and-interviews/?couponCode=github_discount)! + +--- + +## Using Docker to run class notebooks and exercises + +![image](https://github.com/kevinknights29/Airflow_Docs_LLM_App/assets/74464814/339aa9d3-32f9-404e-b449-4b493d015d74) + +![image](https://github.com/kevinknights29/Airflow_Docs_LLM_App/assets/74464814/ef50ac23-b023-4b8b-bde8-d2775c240cc9) + +In this repo you can find a series of Docker files: + +- A [Dockerfile](./Dockerfile), which builds a jupyter lab container with all class materials. +- A [docker-compose.yml](./docker-compose.yml), which simplifies the build, start and stopage of the jupyterlab environment. +- A [.dockerignore](./.dockerignore), which exclude files from getting into the container. + +### Usage + +1. For first time usage, you need to build the Docker image: + +```bash +docker compose build . +``` + +2. After that you can start the container with: + +```bash +docker compose up -d +``` + +3. Go to Docker desktop, to retrieve your jupyterlab access URL. + + - Click the container name, to open the logs. + - Retrive the jupyterlab URL, it should look like: `http://127.0.0.1:8888/lab?token=4150032f3603c85febf54b8b40bb761a2eb46e2fb593d5dc` + +![image](https://github.com/kevinknights29/Airflow_Docs_LLM_App/assets/74464814/661f3747-2b2e-4387-9c79-64af1d8bc56e) +4. To stop the container, run: +```bash +docker compose down +```