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 \ wget \ git \ curl \ python3 \ python3-dev \ python3-pip \ ffmpeg \ 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 # ollama インストール # RUN curl -fsSL https://ollama.com/install.sh | sh # uv インストール RUN curl -LsSf https://astral.sh/uv/install.sh | sh # uv 環境変数設定 ENV PATH /opt/jupyter/.local/bin:$PATH # python インストール RUN uv python install COPY ./pyproject.toml /opt/jupyter/ RUN uv sync RUN uv run --with jupyter 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 CMD ["uv", "run", "--with", "jupyter", "jupyter", "lab"]