diff --git a/README.md b/README.md index c9e3ae5..6affef1 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,73 @@ -# Jupyter-my-own-image +# Jupyter Notebook Docker Setup -This is my custom image of python jupyter. +This repository contains Docker configuration for running Jupyter Notebook with various data science libraries pre-installed. -This repo was created to run jupyter in docker on raspberry pi (arm) \ No newline at end of file +## Features + +- Based on Ubuntu Focal (20.04) +- Includes Jupyter Notebook with: + - Pandas + - OpenCV + - Scikit-learn + - Scikit-image + - PyTorch + - Imutils + - Notebook export capabilities (nbconvert) +- Volume mounted for persistent notebook storage +- Two deployment profiles (build locally or pull from registry) + +## Directory Structure + +``` +. +├── Dockerfile # Docker image definition +├── docker-compose.yml # Services configuration +├── requirements.txt # Python package dependencies +└── notebooks/ # Directory for your Jupyter notebooks (will be created) +``` + +## Usage + +### Create notebooks directory + +```bash +mkdir -p notebooks +``` + +### Profile 1: Build locally + +To build the Docker image locally and run the container: + +```bash +docker-compose --profile build up +``` + +### Profile 2: Pull from your registry + +To pull the image from your private registry and run it: + +```bash +REGISTRY_URL=your-registry-url docker-compose --profile registry up +``` + +Replace `your-registry-url` with your actual Docker registry URL. + +## Accessing Jupyter Notebook + +Once the container is running, access Jupyter Notebook by opening a browser and navigating to: + +``` +http://localhost:8888 +``` + +No password is required (for simplicity - you may want to add authentication for production use). + +## Customization + +- To add more Python packages, modify the `pip3 install` command in the Dockerfile +- To change the Jupyter configuration, modify the command in docker-compose.yml + +## Notes + +- The notebooks directory is mounted as a volume to persist your work +- For security in production environments, consider adding authentication to your Jupyter instance \ No newline at end of file diff --git a/compose.yml b/compose.yml new file mode 100644 index 0000000..934102e --- /dev/null +++ b/compose.yml @@ -0,0 +1,22 @@ +services: + jupyter: + profiles: ["build", "registry"] + image: https://git.seccodesmith.pl/seccodesmith/Jupyter-my-own-image.git + build: + context: . + dockerfile: Dockerfile + ports: + - "8888:8888" + volumes: + - ./notebooks:/notebooks + environment: + - JUPYTER_ENABLE_LAB=yes + restart: unless-stopped + command: > + jupyter notebook + --ip='0.0.0.0' + --port=8888 + --no-browser + --NotebookApp.token='' + --NotebookApp.password='' + --allow-root \ No newline at end of file diff --git a/dockerfile b/dockerfile index 5ddf2dc..4c91670 100644 --- a/dockerfile +++ b/dockerfile @@ -6,20 +6,19 @@ RUN apt-get update && apt-get install -y \ python3 \ python3-pip \ python3-dev \ - build-essential \ - pandoc \ - texlive-xetex \ - libsm6 \ - libxext6 \ - libxrender-dev \ + git \ + wget \ + curl \ + && apt-get clean \ && rm -rf /var/lib/apt/lists/* -WORKDIR /app +COPY requirements.txt /tmp/ -COPY requirements.txt . -RUN pip3 install --no-cache-dir --upgrade pip \ - && pip3 install --no-cache-dir -r requirements.txt +RUN pip3 install --no-cache-dir --upgrade pip && \ + pip3 install --no-cache-dir -r /tmp/requirements.txt + +WORKDIR /notebooks EXPOSE 8888 -CMD ["jupyter", "lab", "--ip=0.0.0.0", "--port=8888", "--allow-root", "--no-browser", "--NotebookApp.token=''"] \ No newline at end of file +CMD ["jupyter", "notebook", "--ip='0.0.0.0'", "--port=8888", "--no-browser", "--allow-root"] \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 6cc1b1b..3f253c9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,10 +1,12 @@ -jupyterlab +jupyter notebook nbconvert numpy pandas -matplotlib +opencv-python scikit-learn scikit-image torch -torchvision \ No newline at end of file +torchvision +torchaudio +imutils \ No newline at end of file