Skip to content

Instantly share code, notes, and snippets.

@diyism
Last active December 6, 2023 15:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save diyism/6467a053ec281bc607e9a9692dbb3813 to your computer and use it in GitHub Desktop.
Save diyism/6467a053ec281bc607e9a9692dbb3813 to your computer and use it in GitHub Desktop.
run docker in huggingface with jupyter
===========Dockerfile(password: 名字前两字数符):===========
FROM k2fsa/icefall:torch1.13.0-cuda11.6
USER root
RUN apt update -y ; apt install -y iputils-ping curl
RUN chmod -R 777 /workspace
RUN ln -s /opt/conda/lib/stubs/libcuda.so /opt/conda/lib/stubs/libcuda.so.1
ENV SHELL=/bin/bash
RUN pip install jupyterlab
RUN useradd -m -u 1000 user
USER user
RUN jupyter lab --generate-config
RUN echo "c.PasswordIdentityProvider.password_required=True">>/home/user/.jupyter/jupyter_lab_config.py
RUN echo "c.PasswordIdentityProvider.hashed_password='argon2:\$argon2id\$v=19\$m=10240,t=10,p=8\$ADVOtoQgkVyBkD2MAacNdg\$RwMBZJA+LsqnMQXxNElfTuUzHUOu1MvaRZ1kypvec9g'">>/home/user/.jupyter/jupyter_lab_config.py
CMD ["jupyter", "lab", "--ip=0.0.0.0", "--port=8888", "--no-browser", "--allow-root"]
===========README.md:===========
title: Icefall
emoji: 📊
colorFrom: purple
colorTo: blue
sdk: docker
pinned: false
app_port: 8888
================debian:bookworm-slim+jupyterlab:===========
FROM debian:bookworm-slim
RUN echo "root:654321" | chpasswd
RUN apt update -y ; apt install -y iputils-ping curl python3-venv sudo
RUN python3 -m venv v1
ENV PATH="/v1/bin:$PATH"
RUN pip install jupyterlab
RUN useradd -m -u 1000 user_cmd
RUN usermod -aG sudo user_cmd
RUN echo "user_cmd ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
USER user_cmd
RUN jupyter lab --generate-config
RUN echo "c.PasswordIdentityProvider.password_required=True">>/home/user_cmd/.jupyter/jupyter_lab_config.py
RUN echo "c.PasswordIdentityProvider.hashed_password='argon2:\$argon2id\$v=19\$m=10240,t=10,p=8\$ADVOtoQgkVyBkD2MAacNdg\$RwMBZJA+LsqnMQXxNElfTuUzHUOu1MvaRZ1kypvec9g'">>/home/user_cmd/.jupyter/jupyter_lab_config.py
ENV SHELL=/bin/bash
WORKDIR /home/user_cmd
CMD jupyter lab --ip=0.0.0.0 --port=8888 --no-browser --allow-root
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment