Last active
April 2, 2023 15:02
-
-
Save chenyaofo/fa11973134575c597ca2aa62b1175864 to your computer and use it in GitHub Desktop.
Dockerfile for build PyTorch via Github Actions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM nvidia/cuda:11.8.0-devel-ubuntu22.04 | |
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 \ | |
PATH=/opt/conda/bin:$PATH \ | |
TZ=Asia/Shanghai \ | |
PYTHON_VERSION=3.9 | |
RUN APT_INSTALL="apt-get install -y --no-install-recommends --no-install-suggests" && \ | |
GIT_CLONE="git clone --depth 10" && \ | |
rm -rf /etc/apt/sources.list.d/cuda.list \ | |
/etc/apt/sources.list.d/nvidia-ml.list && \ | |
rm -f /etc/apt/apt.conf.d/docker-clean && \ | |
apt-get update && \ | |
DEBIAN_FRONTEND=noninteractive $APT_INSTALL ca-certificates tzdata git wget curl vim htop rsync psmisc unzip openssh-server dnsutils iputils-ping net-tools rsync lftp ncdu tmux less && \ | |
apt-get clean | |
RUN ln -fs /usr/share/zoneinfo/${TZ} /etc/localtime && \ | |
echo ${TZ} > /etc/timezone && \ | |
dpkg-reconfigure --frontend noninteractive tzdata | |
RUN wget https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-Linux-x86_64.sh -O ~/installer.sh && \ | |
/bin/bash ~/installer.sh -b -p /opt/conda && \ | |
rm ~/installer.sh && \ | |
ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh && \ | |
echo ". /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc && \ | |
echo "conda activate dev" >> ~/.bashrc && \ | |
find /opt/conda/ -follow -type f -name '*.a' -delete && \ | |
find /opt/conda/ -follow -type f -name '*.js.map' -delete | |
RUN /opt/conda/bin/mamba create -n dev python=${PYTHON_VERSION} && \ | |
CONDA_INSTALL="/opt/conda/bin/mamba install -n dev -y" && \ | |
$CONDA_INSTALL -c conda-forge pycocotools graphviz rclone && \ | |
/opt/conda/bin/mamba clean -afy && \ | |
echo 'Conda Install Done!' | |
RUN PIP_INSTALL="/opt/conda/envs/dev/bin/pip install --upgrade --no-cache-dir" && \ | |
$PIP_INSTALL torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 && \ | |
$PIP_INSTALL tfrecord scipy scikit-learn pandas numba scikit-image && \ | |
$PIP_INSTALL fvcore glances gpustat && \ | |
$PIP_INSTALL pyyaml pyhocon && \ | |
$PIP_INSTALL webdataset && \ | |
$PIP_INSTALL transformers huggingface_hub datasets accelerate && \ | |
$PIP_INSTALL pytorch-lightning lightning-bolts torchmetrics lightning-transformers && \ | |
$PIP_INSTALL tensorboard requests jupyterlab && \ | |
$PIP_INSTALL mmcv mmcls mmdet mmsegmentation mmselfsup timm && \ | |
$PIP_INSTALL --extra-index-url https://developer.download.nvidia.com/compute/redist --upgrade nvidia-dali-cuda110 && \ | |
echo 'PIP Install Done!' | |
CMD ["sh","-c", "/opt/conda/bin/jupyter lab --no-browser --ip=0.0.0.0 --allow-root --notebook-dir='/code' --port=8888 --LabApp.token='' --LabApp.allow_origin='*' --LabApp.base_url=$OCTOPUS_JPY_BASE_URL"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment