Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding functionality to run class material with Docker #30

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Dockerfile
docker-compose.yml
overrides.json
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.ipynb_checkpoints/
**/.ipynb_checkpoints/
57 changes: 57 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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}"
45 changes: 42 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
```
11 changes: 11 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions overrides.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"@jupyterlab/apputils-extension:themes": {
"theme": "JupyterLab Dark"
}
}