Browse Source

完善jupyterhub镜像构建

herj 2 năm trước cách đây
mục cha
commit
195a298012

+ 2 - 1
Dockerfile

@@ -10,7 +10,8 @@ RUN if [ -e /src/.cache/yarn.tar.gz ]; then \
 FROM ylproj-jupyterhub:1.0.0
 COPY --from=builder /src/dist/*.whl /src/sparkmagic/dist/*.whl /dist/
 RUN jupyter kernelspec uninstall -y pysparkkernel && \
-    pip install --force-reinstall --no-deps /dist/*.whl && rm -rf /dist && \
+    pip uninstall -y jupyterlab sparkmagic && \
+    pip install /dist/*.whl && rm -rf /dist && \
     jupyter kernelspec install /usr/local/lib/python3.8/dist-packages/sparkmagic/kernels/pysparkkernel && \
     useradd -m -p "VawT4F4qizTuw" test1 && \
     useradd -m -p "vt8SVDBWk0fHI" test2 && \

+ 5 - 2
docker_build/Dockerfile

@@ -1,8 +1,11 @@
 FROM node:16.15.1-bullseye-slim
 WORKDIR /build
-COPY sources.list /etc/apt/
 COPY requirements.txt .
-RUN apt update && apt install -y python3 python3-pip python-is-python3 make git \
+RUN echo "deb http://mirror.nju.edu.cn/debian/ bullseye main contrib non-free" > /etc/apt/sources.list && \
+    echo "deb http://mirror.nju.edu.cn/debian/ bullseye-updates main contrib non-free" >> /etc/apt/sources.list && \
+    echo "deb http://mirror.nju.edu.cn/debian/ bullseye-backports main contrib non-free" >> /etc/apt/sources.list && \
+    echo "deb http://mirror.nju.edu.cn/debian-security bullseye-security main contrib non-free" >> /etc/apt/sources.list && \
+    apt update && apt install -y python3 python3-pip python-is-python3 make git \
     && pip config set global.index-url https://mirror.nju.edu.cn/pypi/web/simple \
     && pip install -U pip setuptools && pip install -r requirements.txt \
     && rm requirements.txt \

+ 0 - 4
docker_build/sources.list

@@ -1,4 +0,0 @@
-deb http://mirror.nju.edu.cn/debian/ bullseye main contrib non-free
-deb http://mirror.nju.edu.cn/debian/ bullseye-updates main contrib non-free
-deb http://mirror.nju.edu.cn/debian/ bullseye-backports main contrib non-free
-deb http://mirror.nju.edu.cn/debian-security bullseye-security main contrib non-free

+ 5 - 2
docker_jupyterhub/Dockerfile

@@ -1,7 +1,10 @@
 FROM jupyterhub/jupyterhub:2.3
-COPY sources.list /etc/apt/
 COPY requirements.txt .
-RUN apt update && apt install -y libkrb5-dev krb5-user gcc python3-dev git openjdk-8-jre && \
+RUN echo "deb http://mirror.nju.edu.cn/ubuntu/ focal main restricted universe multiverse" > /etc/apt/sources.list && \
+    echo "deb http://mirror.nju.edu.cn/ubuntu/ focal-updates main restricted universe multiverse" >> /etc/apt/sources.list && \
+    echo "deb http://mirror.nju.edu.cn/ubuntu/ focal-backports main restricted universe multiverse" >> /etc/apt/sources.list && \
+    echo "deb http://mirror.nju.edu.cn/ubuntu/ focal-security main restricted universe multiverse" >> /etc/apt/sources.list && \
+    apt update && apt install -y libkrb5-dev krb5-user gcc python3-dev git openjdk-8-jre && \
     pip config set global.index-url https://mirror.nju.edu.cn/pypi/web/simple && \
     pip install -r requirements.txt && rm requirements.txt && \
     jupyter kernelspec install /usr/local/lib/python3.8/dist-packages/sparkmagic/kernels/pysparkkernel && \

+ 2 - 1
docker_jupyterhub/run.py

@@ -5,7 +5,8 @@ from pathlib import Path
 from time import sleep
 from threading import Thread
 
-keytab_path = Path(os.environ.get("KEYTAB_PATH", "/etc/jupyterhub/user.keytab"))
+hadoop_conf_dir = os.environ["HADOOP_CONF_DIR"]
+keytab_path = Path(os.environ.get("KEYTAB_PATH", f"{hadoop_conf_dir}/user.keytab"))
 use_krb = keytab_path.exists()
 
 if use_krb:

+ 0 - 4
docker_jupyterhub/sources.list

@@ -1,4 +0,0 @@
-deb http://mirror.nju.edu.cn/ubuntu/ focal main restricted universe multiverse
-deb http://mirror.nju.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
-deb http://mirror.nju.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
-deb http://mirror.nju.edu.cn/ubuntu/ focal-security main restricted universe multiverse