diff --git a/README.md b/README.md new file mode 100644 index 0000000..126b844 --- /dev/null +++ b/README.md @@ -0,0 +1,32 @@ +# Jupyter Lab + +# イメージ作成 + +* GPU対応の場合 +``` +cp jupyter/Dockerfile.gpu jupyter/Dockerfile +docker compose build +``` + + +* CPU の場合 +``` +cp jupyter/Dockerfile.gpu jupyter/Dockerfile +docker compose build +``` + + +# 起動 +docker compose up -d + + +# 終了 +docker compose down + + +# Jupyter Lab へのアクセス +http://localhost:8000/lab?token=jupyter + +notebook 配下にファイルが保存されます。 + + diff --git a/README.md b/README.md new file mode 100644 index 0000000..126b844 --- /dev/null +++ b/README.md @@ -0,0 +1,32 @@ +# Jupyter Lab + +# イメージ作成 + +* GPU対応の場合 +``` +cp jupyter/Dockerfile.gpu jupyter/Dockerfile +docker compose build +``` + + +* CPU の場合 +``` +cp jupyter/Dockerfile.gpu jupyter/Dockerfile +docker compose build +``` + + +# 起動 +docker compose up -d + + +# 終了 +docker compose down + + +# Jupyter Lab へのアクセス +http://localhost:8000/lab?token=jupyter + +notebook 配下にファイルが保存されます。 + + diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..ad65041 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,21 @@ +services: + jupyter: + build: + context: ./jupyter + dockerfile: Dockerfile + image: jupyter:latest + ports: + - 0.0.0.0:8000:8000 + volumes: + - ./notebook:/opt/jupyter/jupyterlab + tty: true + deploy: + resources: + reservations: + devices: + - driver: nvidia + count: 1 + capabilities: [gpu] + + + diff --git a/README.md b/README.md new file mode 100644 index 0000000..126b844 --- /dev/null +++ b/README.md @@ -0,0 +1,32 @@ +# Jupyter Lab + +# イメージ作成 + +* GPU対応の場合 +``` +cp jupyter/Dockerfile.gpu jupyter/Dockerfile +docker compose build +``` + + +* CPU の場合 +``` +cp jupyter/Dockerfile.gpu jupyter/Dockerfile +docker compose build +``` + + +# 起動 +docker compose up -d + + +# 終了 +docker compose down + + +# Jupyter Lab へのアクセス +http://localhost:8000/lab?token=jupyter + +notebook 配下にファイルが保存されます。 + + diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..ad65041 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,21 @@ +services: + jupyter: + build: + context: ./jupyter + dockerfile: Dockerfile + image: jupyter:latest + ports: + - 0.0.0.0:8000:8000 + volumes: + - ./notebook:/opt/jupyter/jupyterlab + tty: true + deploy: + resources: + reservations: + devices: + - driver: nvidia + count: 1 + capabilities: [gpu] + + + diff --git a/jupyter/Dockerfile b/jupyter/Dockerfile new file mode 100644 index 0000000..cf5b0a7 --- /dev/null +++ b/jupyter/Dockerfile @@ -0,0 +1,45 @@ +FROM python:3.10.17-bookworm + +ENV DEBIAN_FRONTEND=noninteractive +# ENV http_proxy=http://127.0.0.1:3128/ +# ENV https_proxy=http://127.0.0.1:3128/ + +# 必要パッケージインストール +RUN \ + apt-get update && \ + apt-get -y upgrade && \ + apt-get install -y \ + sudo \ + postgresql-client \ + && \ + rm -rf /var/lib/apt/lists/* + +# ユーザー追加 +RUN useradd -m jupyter --home-dir /opt/jupyter && \ + echo "jupyter ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/jupyter + +# jupyter ユーザーで実行 +USER jupyter +WORKDIR /opt/jupyter + +COPY ./requirements.txt /opt/jupyter/ + +RUN python -m venv ~/.venv && \ + . ~/.venv/bin/activate && \ + pip install --upgrade pip && \ + pip install jupyterlab && \ + pip install -r requirements.txt && \ + jupyter lab --generate-config && \ + sed -i \ + -e "s/^# c.ServerApp.ip.*$/c.ServerApp.ip = '0.0.0.0'/" \ + -e "s/^# c.ServerApp.port.*$/c.ServerApp.port = 8000/" \ + -e "s/^# c.ServerApp.password_required.*$/c.ServerApp.password_required = False/" \ + -e "s/^# c.ServerApp.token.*$/c.ServerApp.token = 'jupyter'/" \ + ~/.jupyter/jupyter_lab_config.py + +# Jupyter Lab 実行時の作業ディレクトリ +WORKDIR /opt/jupyter/jupyterlab +ENV PATH /opt/jupyter/.venv/bin:$PATH + +CMD ["jupyter", "lab"] + diff --git a/README.md b/README.md new file mode 100644 index 0000000..126b844 --- /dev/null +++ b/README.md @@ -0,0 +1,32 @@ +# Jupyter Lab + +# イメージ作成 + +* GPU対応の場合 +``` +cp jupyter/Dockerfile.gpu jupyter/Dockerfile +docker compose build +``` + + +* CPU の場合 +``` +cp jupyter/Dockerfile.gpu jupyter/Dockerfile +docker compose build +``` + + +# 起動 +docker compose up -d + + +# 終了 +docker compose down + + +# Jupyter Lab へのアクセス +http://localhost:8000/lab?token=jupyter + +notebook 配下にファイルが保存されます。 + + diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..ad65041 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,21 @@ +services: + jupyter: + build: + context: ./jupyter + dockerfile: Dockerfile + image: jupyter:latest + ports: + - 0.0.0.0:8000:8000 + volumes: + - ./notebook:/opt/jupyter/jupyterlab + tty: true + deploy: + resources: + reservations: + devices: + - driver: nvidia + count: 1 + capabilities: [gpu] + + + diff --git a/jupyter/Dockerfile b/jupyter/Dockerfile new file mode 100644 index 0000000..cf5b0a7 --- /dev/null +++ b/jupyter/Dockerfile @@ -0,0 +1,45 @@ +FROM python:3.10.17-bookworm + +ENV DEBIAN_FRONTEND=noninteractive +# ENV http_proxy=http://127.0.0.1:3128/ +# ENV https_proxy=http://127.0.0.1:3128/ + +# 必要パッケージインストール +RUN \ + apt-get update && \ + apt-get -y upgrade && \ + apt-get install -y \ + sudo \ + postgresql-client \ + && \ + rm -rf /var/lib/apt/lists/* + +# ユーザー追加 +RUN useradd -m jupyter --home-dir /opt/jupyter && \ + echo "jupyter ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/jupyter + +# jupyter ユーザーで実行 +USER jupyter +WORKDIR /opt/jupyter + +COPY ./requirements.txt /opt/jupyter/ + +RUN python -m venv ~/.venv && \ + . ~/.venv/bin/activate && \ + pip install --upgrade pip && \ + pip install jupyterlab && \ + pip install -r requirements.txt && \ + jupyter lab --generate-config && \ + sed -i \ + -e "s/^# c.ServerApp.ip.*$/c.ServerApp.ip = '0.0.0.0'/" \ + -e "s/^# c.ServerApp.port.*$/c.ServerApp.port = 8000/" \ + -e "s/^# c.ServerApp.password_required.*$/c.ServerApp.password_required = False/" \ + -e "s/^# c.ServerApp.token.*$/c.ServerApp.token = 'jupyter'/" \ + ~/.jupyter/jupyter_lab_config.py + +# Jupyter Lab 実行時の作業ディレクトリ +WORKDIR /opt/jupyter/jupyterlab +ENV PATH /opt/jupyter/.venv/bin:$PATH + +CMD ["jupyter", "lab"] + diff --git a/jupyter/Dockerfile.gpu b/jupyter/Dockerfile.gpu new file mode 100644 index 0000000..6e02066 --- /dev/null +++ b/jupyter/Dockerfile.gpu @@ -0,0 +1,71 @@ +FROM nvidia/cuda:12.6.3-cudnn-runtime-ubuntu24.04 + +ENV DEBIAN_FRONTEND=noninteractive +# ENV http_proxy=http://127.0.0.1:3128/ +# ENV https_proxy=http://127.0.0.1:3128/ + +# 必要パッケージインストール +RUN \ + apt-get update && \ + apt-get -y upgrade && \ + apt-get install -y \ + sudo \ + wget \ + git \ + curl \ + python3 \ + python3-dev \ + python3-pip \ + ffmpeg \ + build-essential libbz2-dev libdb-dev \ + libreadline-dev libffi-dev libgdbm-dev liblzma-dev \ + libncursesw5-dev libsqlite3-dev libssl-dev \ + zlib1g-dev uuid-dev tk-dev \ + postgresql-client \ + && \ + rm -rf /var/lib/apt/lists/* + +# ユーザー追加 +RUN useradd -m jupyter --home-dir /opt/jupyter && \ + echo "jupyter ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/jupyter + +# jupyter ユーザーで実行 +USER jupyter +WORKDIR /opt/jupyter + +# pyenv インストール +RUN curl https://pyenv.run | bash + +# pyenv 環境変数設定 +ENV PYENV_ROOT /opt/jupyter/.pyenv +ENV PATH $PYENV_ROOT/bin:$PYENV_ROOT/shims:$PATH + +# pyenv 初期化、python ビルド +RUN \ + eval "$(pyenv init --path)" && \ + pyenv update && \ + pyenv install 3.13 && \ + pyenv global 3.13 + +COPY ./requirements.txt /opt/jupyter/ + +RUN python -m venv ~/.venv && \ + . ~/.venv/bin/activate && \ + pip install --upgrade pip && \ + pip install jupyterlab && \ + pip install -r requirements.txt && \ + pip cache purge && \ + jupyter lab --generate-config && \ + sed -i \ + -e "s/^# c.ServerApp.ip.*$/c.ServerApp.ip = '0.0.0.0'/" \ + -e "s/^# c.ServerApp.port.*$/c.ServerApp.port = 8000/" \ + -e "s/^# c.ServerApp.password_required.*$/c.ServerApp.password_required = False/" \ + -e "s/^# c.ServerApp.token.*$/c.ServerApp.token = 'jupyter'/" \ + ~/.jupyter/jupyter_lab_config.py + +# Jupyter Lab 実行時の作業ディレクトリ +WORKDIR /opt/jupyter/jupyterlab +ENV PATH /opt/jupyter/.venv/bin:$PATH + +CMD ["jupyter", "lab"] + diff --git a/README.md b/README.md new file mode 100644 index 0000000..126b844 --- /dev/null +++ b/README.md @@ -0,0 +1,32 @@ +# Jupyter Lab + +# イメージ作成 + +* GPU対応の場合 +``` +cp jupyter/Dockerfile.gpu jupyter/Dockerfile +docker compose build +``` + + +* CPU の場合 +``` +cp jupyter/Dockerfile.gpu jupyter/Dockerfile +docker compose build +``` + + +# 起動 +docker compose up -d + + +# 終了 +docker compose down + + +# Jupyter Lab へのアクセス +http://localhost:8000/lab?token=jupyter + +notebook 配下にファイルが保存されます。 + + diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..ad65041 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,21 @@ +services: + jupyter: + build: + context: ./jupyter + dockerfile: Dockerfile + image: jupyter:latest + ports: + - 0.0.0.0:8000:8000 + volumes: + - ./notebook:/opt/jupyter/jupyterlab + tty: true + deploy: + resources: + reservations: + devices: + - driver: nvidia + count: 1 + capabilities: [gpu] + + + diff --git a/jupyter/Dockerfile b/jupyter/Dockerfile new file mode 100644 index 0000000..cf5b0a7 --- /dev/null +++ b/jupyter/Dockerfile @@ -0,0 +1,45 @@ +FROM python:3.10.17-bookworm + +ENV DEBIAN_FRONTEND=noninteractive +# ENV http_proxy=http://127.0.0.1:3128/ +# ENV https_proxy=http://127.0.0.1:3128/ + +# 必要パッケージインストール +RUN \ + apt-get update && \ + apt-get -y upgrade && \ + apt-get install -y \ + sudo \ + postgresql-client \ + && \ + rm -rf /var/lib/apt/lists/* + +# ユーザー追加 +RUN useradd -m jupyter --home-dir /opt/jupyter && \ + echo "jupyter ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/jupyter + +# jupyter ユーザーで実行 +USER jupyter +WORKDIR /opt/jupyter + +COPY ./requirements.txt /opt/jupyter/ + +RUN python -m venv ~/.venv && \ + . ~/.venv/bin/activate && \ + pip install --upgrade pip && \ + pip install jupyterlab && \ + pip install -r requirements.txt && \ + jupyter lab --generate-config && \ + sed -i \ + -e "s/^# c.ServerApp.ip.*$/c.ServerApp.ip = '0.0.0.0'/" \ + -e "s/^# c.ServerApp.port.*$/c.ServerApp.port = 8000/" \ + -e "s/^# c.ServerApp.password_required.*$/c.ServerApp.password_required = False/" \ + -e "s/^# c.ServerApp.token.*$/c.ServerApp.token = 'jupyter'/" \ + ~/.jupyter/jupyter_lab_config.py + +# Jupyter Lab 実行時の作業ディレクトリ +WORKDIR /opt/jupyter/jupyterlab +ENV PATH /opt/jupyter/.venv/bin:$PATH + +CMD ["jupyter", "lab"] + diff --git a/jupyter/Dockerfile.gpu b/jupyter/Dockerfile.gpu new file mode 100644 index 0000000..6e02066 --- /dev/null +++ b/jupyter/Dockerfile.gpu @@ -0,0 +1,71 @@ +FROM nvidia/cuda:12.6.3-cudnn-runtime-ubuntu24.04 + +ENV DEBIAN_FRONTEND=noninteractive +# ENV http_proxy=http://127.0.0.1:3128/ +# ENV https_proxy=http://127.0.0.1:3128/ + +# 必要パッケージインストール +RUN \ + apt-get update && \ + apt-get -y upgrade && \ + apt-get install -y \ + sudo \ + wget \ + git \ + curl \ + python3 \ + python3-dev \ + python3-pip \ + ffmpeg \ + build-essential libbz2-dev libdb-dev \ + libreadline-dev libffi-dev libgdbm-dev liblzma-dev \ + libncursesw5-dev libsqlite3-dev libssl-dev \ + zlib1g-dev uuid-dev tk-dev \ + postgresql-client \ + && \ + rm -rf /var/lib/apt/lists/* + +# ユーザー追加 +RUN useradd -m jupyter --home-dir /opt/jupyter && \ + echo "jupyter ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/jupyter + +# jupyter ユーザーで実行 +USER jupyter +WORKDIR /opt/jupyter + +# pyenv インストール +RUN curl https://pyenv.run | bash + +# pyenv 環境変数設定 +ENV PYENV_ROOT /opt/jupyter/.pyenv +ENV PATH $PYENV_ROOT/bin:$PYENV_ROOT/shims:$PATH + +# pyenv 初期化、python ビルド +RUN \ + eval "$(pyenv init --path)" && \ + pyenv update && \ + pyenv install 3.13 && \ + pyenv global 3.13 + +COPY ./requirements.txt /opt/jupyter/ + +RUN python -m venv ~/.venv && \ + . ~/.venv/bin/activate && \ + pip install --upgrade pip && \ + pip install jupyterlab && \ + pip install -r requirements.txt && \ + pip cache purge && \ + jupyter lab --generate-config && \ + sed -i \ + -e "s/^# c.ServerApp.ip.*$/c.ServerApp.ip = '0.0.0.0'/" \ + -e "s/^# c.ServerApp.port.*$/c.ServerApp.port = 8000/" \ + -e "s/^# c.ServerApp.password_required.*$/c.ServerApp.password_required = False/" \ + -e "s/^# c.ServerApp.token.*$/c.ServerApp.token = 'jupyter'/" \ + ~/.jupyter/jupyter_lab_config.py + +# Jupyter Lab 実行時の作業ディレクトリ +WORKDIR /opt/jupyter/jupyterlab +ENV PATH /opt/jupyter/.venv/bin:$PATH + +CMD ["jupyter", "lab"] + diff --git a/jupyter/requirements.txt b/jupyter/requirements.txt new file mode 100644 index 0000000..14e5e9e --- /dev/null +++ b/jupyter/requirements.txt @@ -0,0 +1,11 @@ +pandas +numpy +requests +matplotlib +openpyxl +ollama +psycopg-binary +python-dotenv +SQLAlchemy +torch + diff --git a/README.md b/README.md new file mode 100644 index 0000000..126b844 --- /dev/null +++ b/README.md @@ -0,0 +1,32 @@ +# Jupyter Lab + +# イメージ作成 + +* GPU対応の場合 +``` +cp jupyter/Dockerfile.gpu jupyter/Dockerfile +docker compose build +``` + + +* CPU の場合 +``` +cp jupyter/Dockerfile.gpu jupyter/Dockerfile +docker compose build +``` + + +# 起動 +docker compose up -d + + +# 終了 +docker compose down + + +# Jupyter Lab へのアクセス +http://localhost:8000/lab?token=jupyter + +notebook 配下にファイルが保存されます。 + + diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..ad65041 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,21 @@ +services: + jupyter: + build: + context: ./jupyter + dockerfile: Dockerfile + image: jupyter:latest + ports: + - 0.0.0.0:8000:8000 + volumes: + - ./notebook:/opt/jupyter/jupyterlab + tty: true + deploy: + resources: + reservations: + devices: + - driver: nvidia + count: 1 + capabilities: [gpu] + + + diff --git a/jupyter/Dockerfile b/jupyter/Dockerfile new file mode 100644 index 0000000..cf5b0a7 --- /dev/null +++ b/jupyter/Dockerfile @@ -0,0 +1,45 @@ +FROM python:3.10.17-bookworm + +ENV DEBIAN_FRONTEND=noninteractive +# ENV http_proxy=http://127.0.0.1:3128/ +# ENV https_proxy=http://127.0.0.1:3128/ + +# 必要パッケージインストール +RUN \ + apt-get update && \ + apt-get -y upgrade && \ + apt-get install -y \ + sudo \ + postgresql-client \ + && \ + rm -rf /var/lib/apt/lists/* + +# ユーザー追加 +RUN useradd -m jupyter --home-dir /opt/jupyter && \ + echo "jupyter ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/jupyter + +# jupyter ユーザーで実行 +USER jupyter +WORKDIR /opt/jupyter + +COPY ./requirements.txt /opt/jupyter/ + +RUN python -m venv ~/.venv && \ + . ~/.venv/bin/activate && \ + pip install --upgrade pip && \ + pip install jupyterlab && \ + pip install -r requirements.txt && \ + jupyter lab --generate-config && \ + sed -i \ + -e "s/^# c.ServerApp.ip.*$/c.ServerApp.ip = '0.0.0.0'/" \ + -e "s/^# c.ServerApp.port.*$/c.ServerApp.port = 8000/" \ + -e "s/^# c.ServerApp.password_required.*$/c.ServerApp.password_required = False/" \ + -e "s/^# c.ServerApp.token.*$/c.ServerApp.token = 'jupyter'/" \ + ~/.jupyter/jupyter_lab_config.py + +# Jupyter Lab 実行時の作業ディレクトリ +WORKDIR /opt/jupyter/jupyterlab +ENV PATH /opt/jupyter/.venv/bin:$PATH + +CMD ["jupyter", "lab"] + diff --git a/jupyter/Dockerfile.gpu b/jupyter/Dockerfile.gpu new file mode 100644 index 0000000..6e02066 --- /dev/null +++ b/jupyter/Dockerfile.gpu @@ -0,0 +1,71 @@ +FROM nvidia/cuda:12.6.3-cudnn-runtime-ubuntu24.04 + +ENV DEBIAN_FRONTEND=noninteractive +# ENV http_proxy=http://127.0.0.1:3128/ +# ENV https_proxy=http://127.0.0.1:3128/ + +# 必要パッケージインストール +RUN \ + apt-get update && \ + apt-get -y upgrade && \ + apt-get install -y \ + sudo \ + wget \ + git \ + curl \ + python3 \ + python3-dev \ + python3-pip \ + ffmpeg \ + build-essential libbz2-dev libdb-dev \ + libreadline-dev libffi-dev libgdbm-dev liblzma-dev \ + libncursesw5-dev libsqlite3-dev libssl-dev \ + zlib1g-dev uuid-dev tk-dev \ + postgresql-client \ + && \ + rm -rf /var/lib/apt/lists/* + +# ユーザー追加 +RUN useradd -m jupyter --home-dir /opt/jupyter && \ + echo "jupyter ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/jupyter + +# jupyter ユーザーで実行 +USER jupyter +WORKDIR /opt/jupyter + +# pyenv インストール +RUN curl https://pyenv.run | bash + +# pyenv 環境変数設定 +ENV PYENV_ROOT /opt/jupyter/.pyenv +ENV PATH $PYENV_ROOT/bin:$PYENV_ROOT/shims:$PATH + +# pyenv 初期化、python ビルド +RUN \ + eval "$(pyenv init --path)" && \ + pyenv update && \ + pyenv install 3.13 && \ + pyenv global 3.13 + +COPY ./requirements.txt /opt/jupyter/ + +RUN python -m venv ~/.venv && \ + . ~/.venv/bin/activate && \ + pip install --upgrade pip && \ + pip install jupyterlab && \ + pip install -r requirements.txt && \ + pip cache purge && \ + jupyter lab --generate-config && \ + sed -i \ + -e "s/^# c.ServerApp.ip.*$/c.ServerApp.ip = '0.0.0.0'/" \ + -e "s/^# c.ServerApp.port.*$/c.ServerApp.port = 8000/" \ + -e "s/^# c.ServerApp.password_required.*$/c.ServerApp.password_required = False/" \ + -e "s/^# c.ServerApp.token.*$/c.ServerApp.token = 'jupyter'/" \ + ~/.jupyter/jupyter_lab_config.py + +# Jupyter Lab 実行時の作業ディレクトリ +WORKDIR /opt/jupyter/jupyterlab +ENV PATH /opt/jupyter/.venv/bin:$PATH + +CMD ["jupyter", "lab"] + diff --git a/jupyter/requirements.txt b/jupyter/requirements.txt new file mode 100644 index 0000000..14e5e9e --- /dev/null +++ b/jupyter/requirements.txt @@ -0,0 +1,11 @@ +pandas +numpy +requests +matplotlib +openpyxl +ollama +psycopg-binary +python-dotenv +SQLAlchemy +torch + diff --git a/notebook/.ipynb_checkpoints/Untitled-checkpoint.ipynb b/notebook/.ipynb_checkpoints/Untitled-checkpoint.ipynb new file mode 100644 index 0000000..363fcab --- /dev/null +++ b/notebook/.ipynb_checkpoints/Untitled-checkpoint.ipynb @@ -0,0 +1,6 @@ +{ + "cells": [], + "metadata": {}, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..126b844 --- /dev/null +++ b/README.md @@ -0,0 +1,32 @@ +# Jupyter Lab + +# イメージ作成 + +* GPU対応の場合 +``` +cp jupyter/Dockerfile.gpu jupyter/Dockerfile +docker compose build +``` + + +* CPU の場合 +``` +cp jupyter/Dockerfile.gpu jupyter/Dockerfile +docker compose build +``` + + +# 起動 +docker compose up -d + + +# 終了 +docker compose down + + +# Jupyter Lab へのアクセス +http://localhost:8000/lab?token=jupyter + +notebook 配下にファイルが保存されます。 + + diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..ad65041 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,21 @@ +services: + jupyter: + build: + context: ./jupyter + dockerfile: Dockerfile + image: jupyter:latest + ports: + - 0.0.0.0:8000:8000 + volumes: + - ./notebook:/opt/jupyter/jupyterlab + tty: true + deploy: + resources: + reservations: + devices: + - driver: nvidia + count: 1 + capabilities: [gpu] + + + diff --git a/jupyter/Dockerfile b/jupyter/Dockerfile new file mode 100644 index 0000000..cf5b0a7 --- /dev/null +++ b/jupyter/Dockerfile @@ -0,0 +1,45 @@ +FROM python:3.10.17-bookworm + +ENV DEBIAN_FRONTEND=noninteractive +# ENV http_proxy=http://127.0.0.1:3128/ +# ENV https_proxy=http://127.0.0.1:3128/ + +# 必要パッケージインストール +RUN \ + apt-get update && \ + apt-get -y upgrade && \ + apt-get install -y \ + sudo \ + postgresql-client \ + && \ + rm -rf /var/lib/apt/lists/* + +# ユーザー追加 +RUN useradd -m jupyter --home-dir /opt/jupyter && \ + echo "jupyter ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/jupyter + +# jupyter ユーザーで実行 +USER jupyter +WORKDIR /opt/jupyter + +COPY ./requirements.txt /opt/jupyter/ + +RUN python -m venv ~/.venv && \ + . ~/.venv/bin/activate && \ + pip install --upgrade pip && \ + pip install jupyterlab && \ + pip install -r requirements.txt && \ + jupyter lab --generate-config && \ + sed -i \ + -e "s/^# c.ServerApp.ip.*$/c.ServerApp.ip = '0.0.0.0'/" \ + -e "s/^# c.ServerApp.port.*$/c.ServerApp.port = 8000/" \ + -e "s/^# c.ServerApp.password_required.*$/c.ServerApp.password_required = False/" \ + -e "s/^# c.ServerApp.token.*$/c.ServerApp.token = 'jupyter'/" \ + ~/.jupyter/jupyter_lab_config.py + +# Jupyter Lab 実行時の作業ディレクトリ +WORKDIR /opt/jupyter/jupyterlab +ENV PATH /opt/jupyter/.venv/bin:$PATH + +CMD ["jupyter", "lab"] + diff --git a/jupyter/Dockerfile.gpu b/jupyter/Dockerfile.gpu new file mode 100644 index 0000000..6e02066 --- /dev/null +++ b/jupyter/Dockerfile.gpu @@ -0,0 +1,71 @@ +FROM nvidia/cuda:12.6.3-cudnn-runtime-ubuntu24.04 + +ENV DEBIAN_FRONTEND=noninteractive +# ENV http_proxy=http://127.0.0.1:3128/ +# ENV https_proxy=http://127.0.0.1:3128/ + +# 必要パッケージインストール +RUN \ + apt-get update && \ + apt-get -y upgrade && \ + apt-get install -y \ + sudo \ + wget \ + git \ + curl \ + python3 \ + python3-dev \ + python3-pip \ + ffmpeg \ + build-essential libbz2-dev libdb-dev \ + libreadline-dev libffi-dev libgdbm-dev liblzma-dev \ + libncursesw5-dev libsqlite3-dev libssl-dev \ + zlib1g-dev uuid-dev tk-dev \ + postgresql-client \ + && \ + rm -rf /var/lib/apt/lists/* + +# ユーザー追加 +RUN useradd -m jupyter --home-dir /opt/jupyter && \ + echo "jupyter ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/jupyter + +# jupyter ユーザーで実行 +USER jupyter +WORKDIR /opt/jupyter + +# pyenv インストール +RUN curl https://pyenv.run | bash + +# pyenv 環境変数設定 +ENV PYENV_ROOT /opt/jupyter/.pyenv +ENV PATH $PYENV_ROOT/bin:$PYENV_ROOT/shims:$PATH + +# pyenv 初期化、python ビルド +RUN \ + eval "$(pyenv init --path)" && \ + pyenv update && \ + pyenv install 3.13 && \ + pyenv global 3.13 + +COPY ./requirements.txt /opt/jupyter/ + +RUN python -m venv ~/.venv && \ + . ~/.venv/bin/activate && \ + pip install --upgrade pip && \ + pip install jupyterlab && \ + pip install -r requirements.txt && \ + pip cache purge && \ + jupyter lab --generate-config && \ + sed -i \ + -e "s/^# c.ServerApp.ip.*$/c.ServerApp.ip = '0.0.0.0'/" \ + -e "s/^# c.ServerApp.port.*$/c.ServerApp.port = 8000/" \ + -e "s/^# c.ServerApp.password_required.*$/c.ServerApp.password_required = False/" \ + -e "s/^# c.ServerApp.token.*$/c.ServerApp.token = 'jupyter'/" \ + ~/.jupyter/jupyter_lab_config.py + +# Jupyter Lab 実行時の作業ディレクトリ +WORKDIR /opt/jupyter/jupyterlab +ENV PATH /opt/jupyter/.venv/bin:$PATH + +CMD ["jupyter", "lab"] + diff --git a/jupyter/requirements.txt b/jupyter/requirements.txt new file mode 100644 index 0000000..14e5e9e --- /dev/null +++ b/jupyter/requirements.txt @@ -0,0 +1,11 @@ +pandas +numpy +requests +matplotlib +openpyxl +ollama +psycopg-binary +python-dotenv +SQLAlchemy +torch + diff --git a/notebook/.ipynb_checkpoints/Untitled-checkpoint.ipynb b/notebook/.ipynb_checkpoints/Untitled-checkpoint.ipynb new file mode 100644 index 0000000..363fcab --- /dev/null +++ b/notebook/.ipynb_checkpoints/Untitled-checkpoint.ipynb @@ -0,0 +1,6 @@ +{ + "cells": [], + "metadata": {}, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/notebook/Untitled.ipynb b/notebook/Untitled.ipynb new file mode 100644 index 0000000..aedccdb --- /dev/null +++ b/notebook/Untitled.ipynb @@ -0,0 +1,181 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "1e47706c-bcfc-4c7f-91bc-c2920d3114c8", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Package Version\n", + "------------------------- --------------\n", + "annotated-types 0.7.0\n", + "anyio 4.9.0\n", + "argon2-cffi 25.1.0\n", + "argon2-cffi-bindings 21.2.0\n", + "arrow 1.3.0\n", + "asttokens 3.0.0\n", + "async-lru 2.0.5\n", + "attrs 25.3.0\n", + "babel 2.17.0\n", + "beautifulsoup4 4.13.4\n", + "bleach 6.2.0\n", + "certifi 2025.7.14\n", + "cffi 1.17.1\n", + "charset-normalizer 3.4.2\n", + "comm 0.2.2\n", + "contourpy 1.3.2\n", + "cycler 0.12.1\n", + "debugpy 1.8.15\n", + "decorator 5.2.1\n", + "defusedxml 0.7.1\n", + "et_xmlfile 2.0.0\n", + "executing 2.2.0\n", + "fastjsonschema 2.21.1\n", + "filelock 3.18.0\n", + "fonttools 4.59.0\n", + "fqdn 1.5.1\n", + "fsspec 2025.7.0\n", + "greenlet 3.2.3\n", + "h11 0.16.0\n", + "httpcore 1.0.9\n", + "httpx 0.28.1\n", + "idna 3.10\n", + "ipykernel 6.30.0\n", + "ipython 9.4.0\n", + "ipython_pygments_lexers 1.1.1\n", + "isoduration 20.11.0\n", + "jedi 0.19.2\n", + "Jinja2 3.1.6\n", + "json5 0.12.0\n", + "jsonpointer 3.0.0\n", + "jsonschema 4.25.0\n", + "jsonschema-specifications 2025.4.1\n", + "jupyter_client 8.6.3\n", + "jupyter_core 5.8.1\n", + "jupyter-events 0.12.0\n", + "jupyter-lsp 2.2.6\n", + "jupyter_server 2.16.0\n", + "jupyter_server_terminals 0.5.3\n", + "jupyterlab 4.4.5\n", + "jupyterlab_pygments 0.3.0\n", + "jupyterlab_server 2.27.3\n", + "kiwisolver 1.4.8\n", + "lark 1.2.2\n", + "MarkupSafe 3.0.2\n", + "matplotlib 3.10.3\n", + "matplotlib-inline 0.1.7\n", + "mistune 3.1.3\n", + "mpmath 1.3.0\n", + "nbclient 0.10.2\n", + "nbconvert 7.16.6\n", + "nbformat 5.10.4\n", + "nest-asyncio 1.6.0\n", + "networkx 3.5\n", + "notebook_shim 0.2.4\n", + "numpy 2.3.1\n", + "nvidia-cublas-cu12 12.6.4.1\n", + "nvidia-cuda-cupti-cu12 12.6.80\n", + "nvidia-cuda-nvrtc-cu12 12.6.77\n", + "nvidia-cuda-runtime-cu12 12.6.77\n", + "nvidia-cudnn-cu12 9.5.1.17\n", + "nvidia-cufft-cu12 11.3.0.4\n", + "nvidia-cufile-cu12 1.11.1.6\n", + "nvidia-curand-cu12 10.3.7.77\n", + "nvidia-cusolver-cu12 11.7.1.2\n", + "nvidia-cusparse-cu12 12.5.4.2\n", + "nvidia-cusparselt-cu12 0.6.3\n", + "nvidia-nccl-cu12 2.26.2\n", + "nvidia-nvjitlink-cu12 12.6.85\n", + "nvidia-nvtx-cu12 12.6.77\n", + "ollama 0.5.1\n", + "openpyxl 3.1.5\n", + "overrides 7.7.0\n", + "packaging 25.0\n", + "pandas 2.3.1\n", + "pandocfilters 1.5.1\n", + "parso 0.8.4\n", + "pexpect 4.9.0\n", + "pillow 11.3.0\n", + "pip 25.1.1\n", + "platformdirs 4.3.8\n", + "prometheus_client 0.22.1\n", + "prompt_toolkit 3.0.51\n", + "psutil 7.0.0\n", + "psycopg-binary 3.2.9\n", + "ptyprocess 0.7.0\n", + "pure_eval 0.2.3\n", + "pycparser 2.22\n", + "pydantic 2.11.7\n", + "pydantic_core 2.33.2\n", + "Pygments 2.19.2\n", + "pyparsing 3.2.3\n", + "python-dateutil 2.9.0.post0\n", + "python-dotenv 1.1.1\n", + "python-json-logger 3.3.0\n", + "pytz 2025.2\n", + "PyYAML 6.0.2\n", + "pyzmq 27.0.0\n", + "referencing 0.36.2\n", + "requests 2.32.4\n", + "rfc3339-validator 0.1.4\n", + "rfc3986-validator 0.1.1\n", + "rfc3987-syntax 1.1.0\n", + "rpds-py 0.26.0\n", + "Send2Trash 1.8.3\n", + "setuptools 80.9.0\n", + "six 1.17.0\n", + "sniffio 1.3.1\n", + "soupsieve 2.7\n", + "SQLAlchemy 2.0.41\n", + "stack-data 0.6.3\n", + "sympy 1.14.0\n", + "terminado 0.18.1\n", + "tinycss2 1.4.0\n", + "torch 2.7.1\n", + "tornado 6.5.1\n", + "traitlets 5.14.3\n", + "triton 3.3.1\n", + "types-python-dateutil 2.9.0.20250708\n", + "typing_extensions 4.14.1\n", + "typing-inspection 0.4.1\n", + "tzdata 2025.2\n", + "uri-template 1.3.0\n", + "urllib3 2.5.0\n", + "wcwidth 0.2.13\n", + "webcolors 24.11.1\n", + "webencodings 0.5.1\n", + "websocket-client 1.8.0\n" + ] + } + ], + "source": [ + "!pip list" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.13.5" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}