@@ -22,13 +22,13 @@ ENV DEBIAN_FRONTEND=noninteractive \
2222 SHELL=/bin/bash \
2323 PATH=/opt/conda/bin:/usr/local/nvidia/bin:/usr/local/cuda/bin:/usr/local/bin:$PATH \
2424 LD_LIBRARY_PATH=/usr/local/nvidia/lib64:$LD_LIBRARY_PATH \
25- JUPYTER_PASSWORD=ubuntu
25+ JUPYTER_PASSWORD=yotta
2626
2727# ===============================
2828# Workspace
2929# ===============================
3030WORKDIR /
31- RUN mkdir -p /workspace && chmod 777 /workspace
31+ RUN mkdir -p /workspace && chmod 777 /workspace /root
3232
3333# ===============================
3434# Base system packages
@@ -44,46 +44,16 @@ RUN apt-get update -y && \
4444 build-essential pkg-config \
4545 && echo "en_US.UTF-8 UTF-8" > /etc/locale.gen \
4646 && locale-gen \
47- && mkdir -p /var/run/sshd \
47+ && mkdir -p /var/run/sshd /var/log/supervisor \
48+ && chmod 700 /var/run/sshd /var/log/supervisor \
49+ && chmod 755 /var/log \
4850 && apt-get clean \
4951 && rm -rf /var/lib/apt/lists/*
5052
5153# ===============================
52- # uv (Astral) - Python package manager
53- # - Install to /usr/local/bin
54- # - Avoids modifying shell profile (suitable for container/CI)
54+ # Remove ubuntu user (for security: prevent unauthorized SSH access)
5555# ===============================
56- ARG UV_VERSION="latest"
57- RUN set -eux; \
58- if [ "${UV_VERSION}" = "latest" ]; then \
59- curl -LsSf https://astral.sh/uv/install.sh | env UV_UNMANAGED_INSTALL="/usr/local/bin" sh; \
60- else \
61- curl -LsSf "https://astral.sh/uv/${UV_VERSION}/install.sh" | env UV_UNMANAGED_INSTALL="/usr/local/bin" sh; \
62- fi; \
63- uv --version
64-
65- # ===============================
66- # Miniconda
67- # ===============================
68- ARG MINICONDA_VERSION="py311_24.1.2-0"
69- ARG CONDA_DIR="/opt/conda"
70-
71- RUN set -eux; \
72- ARCH="$(uname -m)" ; \
73- case "${ARCH}" in \
74- x86_64) MINICONDA_ARCH="x86_64" ;; \
75- aarch64) MINICONDA_ARCH="aarch64" ;; \
76- *) echo "Unsupported arch: ${ARCH}" && exit 1 ;; \
77- esac; \
78- curl -fsSL \
79- "https://repo.anaconda.com/miniconda/Miniconda3-${MINICONDA_VERSION}-Linux-${MINICONDA_ARCH}.sh" \
80- -o /tmp/miniconda.sh; \
81- bash /tmp/miniconda.sh -b -p "${CONDA_DIR}" ; \
82- rm -f /tmp/miniconda.sh; \
83- "${CONDA_DIR}/bin/conda" config --system --set auto_activate_base false; \
84- "${CONDA_DIR}/bin/conda" clean -afy
85-
86- RUN ln -sf /opt/conda/bin/conda /usr/local/bin/conda
56+ RUN userdel -r ubuntu || true
8757
8858# ===============================
8959# Python 3.11 (build from source, with ensurepip)
@@ -101,7 +71,7 @@ RUN set -eux; \
10171 && tar -xzf /tmp/Python.tgz -C /tmp/python-src --strip-components=1 \
10272 && rm -f /tmp/Python.tgz \
10373 && cd /tmp/python-src \
104- && ./configure --enable-optimizations -- with-ensurepip=install \
74+ && ./configure --with-ensurepip=install \
10575 && make -j"$(nproc)" \
10676 && make altinstall \
10777 && cd / \
@@ -125,15 +95,23 @@ RUN python -m pip install --no-cache-dir \
12595 huggingface-hub datasets
12696
12797# ===============================
128- # Patch: ensure python3.11 has Jupyter (required by /start.sh)
129- # Only adds jupyter to the python3.11 environment, does not modify the existing pip install logic
98+ # Build-time assertion: verify Jupyter installation
13099# ===============================
131- RUN /usr/local/bin/python3.11 -m ensurepip --upgrade && \
132- /usr/local/bin/python3.11 -m pip install --no-cache-dir \
133- jupyterlab ipywidgets jupyter-archive notebook==7.3.3
100+ RUN python -c "import jupyter; import notebook; import jupyterlab; print('jupyter ok')"
134101
135- # Build-time assertion: prevents pushing a broken image
136- RUN /usr/local/bin/python3.11 -c "import jupyter; import notebook; import jupyterlab; print('python3.11 jupyter ok')"
102+ # ===============================
103+ # Configure JupyterLab: auto-login with token (no password prompt)
104+ # ===============================
105+ RUN mkdir -p /root/.jupyter && printf '%s\n ' \
106+ 'c.ServerApp.token = "yotta"' \
107+ 'c.ServerApp.password = ""' \
108+ 'c.ServerApp.allow_remote_access = True' \
109+ 'c.ServerApp.allow_origin = "*"' \
110+ 'c.NotebookApp.token = "yotta"' \
111+ 'c.NotebookApp.password = ""' \
112+ 'c.NotebookApp.allow_remote_access = True' \
113+ > /root/.jupyter/jupyter_lab_config.py && \
114+ chmod 600 /root/.jupyter/jupyter_lab_config.py
137115
138116# ===============================
139117# NCCL tests (build from source, force MPI=0 to avoid mpi.h missing)
@@ -145,31 +123,23 @@ RUN set -eux; \
145123 ln -sf /opt/nccl-tests/build/* /usr/local/bin/; \
146124 rm -rf /opt/nccl-tests/.git
147125
148- # ===============================
149- # User
150- # ===============================
151- RUN useradd -ms /bin/bash ubuntu && \
152- usermod -aG sudo ubuntu && \
153- echo "ubuntu ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/ubuntu && \
154- echo "ubuntu:ubuntu" | chpasswd
155-
156- # ===============================
157- # SSH config (start.sh handles sshd startup; this ensures password login is enabled)
158- # ===============================
159- RUN sed -i 's/#PasswordAuthentication yes/PasswordAuthentication yes/' /etc/ssh/sshd_config && \
160- sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config && \
161- rm -f /etc/ssh/ssh_host_*
162126
163127# ===============================
164128# CUDA bin convenience
165129# ===============================
166130RUN ln -sf /usr/local/cuda/bin/* /usr/bin/ || true
167131
168132# ===============================
169- # start.sh (from buildx bake context "scripts")
133+ # Supervisor configuration
170134# ===============================
171- COPY --from=scripts start.sh /start.sh
172- RUN chmod 755 /start.sh
135+ RUN mkdir -p /var/log/supervisor /usr/local/bin && \
136+ chmod 777 /var/log/supervisor /workspace /var/run /var/lib/nginx && \
137+ mkdir -p /run/sshd && \
138+ chmod 700 /run/sshd
139+
140+ COPY --from=scripts start1.sh /start1.sh
141+ RUN chmod 755 /start1.sh && \
142+ sed -i 's/\r $//' /start1.sh
173143
174144# ===============================
175145# nginx / branding
@@ -187,8 +157,8 @@ RUN echo 'cat /etc/yotta.txt' >> /root/.bashrc
187157EXPOSE 22 80 8888
188158
189159# ===============================
190- # Entrypoint: root runs start .sh directly (does not modify the shared start.sh )
160+ # Entrypoint: root runs start1 .sh with explicit bash (ensures bash syntax works )
191161# ===============================
192162USER root
193163WORKDIR /root
194- CMD ["/bin/bash" , "-lc " , "exec /start .sh" ]
164+ CMD ["/bin/bash" , "-c " , "exec /bin/bash /start1 .sh" ]
0 commit comments