-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
72 lines (63 loc) · 3.48 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# Use CUDA 12.4
FROM nvidia/cuda:12.4.1-cudnn-devel-ubuntu22.04
SHELL ["/bin/bash", "-c"]
ENV SHELL=/bin/bash
ENV DEBIAN_FRONTEND=noninteractive
# Export paths for CUDA and cuDNN
RUN echo $'\n\
export CUDA_HOME=/usr/local/cuda \n\
export PATH=/usr/local/cuda/bin:$PATH \n\
export CPATH=/usr/local/cuda/include:/usr/include:$CPATH \n\
export LIBRARY_PATH=/usr/local/cuda/lib64:$LIBRARY_PATH \n\
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64:$LD_LIBRARY_PATH \n\
eval "$(starship init bash)" \n\
' >> /root/.bashrc
# Install basic packages
RUN apt-get update --fix-missing && \
apt-get install bzip2 ca-certificates curl wget git vim nano tree -y && \
apt-get install pandoc texlive-xetex texlive-fonts-recommended texlive-plain-generic -y && \
apt-get clean && rm -rf /var/lib/apt/lists/*
# Install Conda Environment
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/anaconda.sh && \
bash ~/anaconda.sh -b -p $HOME/anaconda && rm ~/anaconda.sh && \
eval "$('/root/anaconda/bin/conda' 'shell.bash' 'hook')" && conda init && \
conda config --set channel_priority strict
# Install Anaconda and JupyterLab
RUN eval "$('/root/anaconda/bin/conda' 'shell.bash' 'hook')" && \
conda create -n lab python=3.12 anaconda ipywidgets nodejs -y && \
echo "conda activate lab" >> /root/.bashrc && \
conda clean -a && pip cache purge
# Setup JupyterLab plugins
RUN eval "$('/root/anaconda/bin/conda' 'shell.bash' 'hook')" && conda activate lab && \
conda install -c conda-forge starship \
jupyterlab-lsp python-lsp-server r-languageserver texlab chktex \
jupyterlab_code_formatter jupyterlab-spellchecker jupyterlab-git \
jupyter-resource-usage jupyterlab_execute_time jupyterlab-latex && \
pip install lckr_jupyterlab_variableinspector jupyterlab_wakatime && \
npm set prefix /root && npm install -g --save-dev remark-language-server \
remark-preset-lint-consistent remark-preset-lint-recommended && \
conda clean -a && pip cache purge && npm cache clean --force && \
jupyter labextension disable "@jupyterlab/apputils-extension:announcements" && \
echo "jupyter lab" > /root/run_jupyter.sh
COPY JupyterLabConfig/jupyter_lab_config.py /root/.jupyter/jupyter_lab_config.py
COPY JupyterLabConfig/extensions/ /root/.jupyter/lab/user-settings/\@jupyterlab/
COPY JupyterLabConfig/jupyterlab-lsp/ /root/.jupyter/lab/user-settings/\@jupyter-lsp/jupyterlab-lsp/
COPY JupyterLabConfig/jupyterlab-lsp/unified_language_server.py /root/anaconda/envs/lab/lib/python3.12/site-packages/jupyter_lsp/specs/unified_language_server.py
COPY JupyterLabConfig/jupyterlab-lsp/remarkrc.yml /root/.remarkrc.yml
COPY JupyterLabConfig/notebooks/ /root/projects/demo_notebooks/
COPY JupyterLabConfig/channels.condarc /root/.condarc
COPY JupyterLabConfig/starship.toml /root/.config/starship.toml
# Install PyTorch and AI libs
RUN eval "$('/root/anaconda/bin/conda' 'shell.bash' 'hook')" && conda activate lab && \
conda install -c pytorch -c nvidia -c conda-forge --strict-channel-priority \
pytorch torchvision torchaudio pytorch-cuda=12.4 \
transformers datasets spacy xgboost \
django beautifulsoup4 && \
pip install opencv-python && \
conda clean -a && pip cache purge
# Run JupyterLab on start
WORKDIR /root/projects
CMD ["/bin/bash", "-i", "/root/run_jupyter.sh"]
EXPOSE 80
HEALTHCHECK --interval=30s --timeout=10s --retries=3 \
CMD curl -f -s http://localhost:80/lab || exit 1