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"]