xref: /aosp_15_r20/external/pytorch/.devcontainer/Dockerfile (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1*da0073e9SAndroid Build Coastguard WorkerFROM mcr.microsoft.com/vscode/devcontainers/miniconda:0-3
2*da0073e9SAndroid Build Coastguard Worker
3*da0073e9SAndroid Build Coastguard Worker#  I am suprised this is needed
4*da0073e9SAndroid Build Coastguard WorkerRUN conda init
5*da0073e9SAndroid Build Coastguard Worker
6*da0073e9SAndroid Build Coastguard Worker# Copy environment.yml (if found) to a temp location so we update the environment. Also
7*da0073e9SAndroid Build Coastguard Worker# copy "noop.txt" so the COPY instruction does not fail if no environment.yml exists.
8*da0073e9SAndroid Build Coastguard WorkerCOPY .devcontainer/cuda/environment.yml .devcontainer/noop.txt /tmp/conda-tmp/
9*da0073e9SAndroid Build Coastguard WorkerRUN if [ -f "/tmp/conda-tmp/environment.yml" ]; then umask 0002 && /opt/conda/bin/conda env update -n base -f /tmp/conda-tmp/environment.yml; fi \
10*da0073e9SAndroid Build Coastguard Worker    && sudo rm -rf /tmp/conda-tmp
11*da0073e9SAndroid Build Coastguard Worker
12*da0073e9SAndroid Build Coastguard Worker# Tools needed for llvm
13*da0073e9SAndroid Build Coastguard WorkerRUN sudo apt-get -y update
14*da0073e9SAndroid Build Coastguard WorkerRUN sudo apt install -y lsb-release wget software-properties-common gnupg
15*da0073e9SAndroid Build Coastguard Worker
16*da0073e9SAndroid Build Coastguard Worker# Install CLANG if version is specified
17*da0073e9SAndroid Build Coastguard WorkerARG CLANG_VERSION
18*da0073e9SAndroid Build Coastguard WorkerRUN if [ -n "$CLANG_VERSION" ]; then \
19*da0073e9SAndroid Build Coastguard Worker    sudo wget https://apt.llvm.org/llvm.sh; \
20*da0073e9SAndroid Build Coastguard Worker    chmod +x llvm.sh; \
21*da0073e9SAndroid Build Coastguard Worker    sudo ./llvm.sh "${CLANG_VERSION}"; \
22*da0073e9SAndroid Build Coastguard Worker    echo 'export CC=clang' >> ~/.bashrc; \
23*da0073e9SAndroid Build Coastguard Worker    echo 'export CXX=clang++' >> ~/.bashrc; \
24*da0073e9SAndroid Build Coastguard Worker    sudo apt update; \
25*da0073e9SAndroid Build Coastguard Worker    sudo apt install -y clang; \
26*da0073e9SAndroid Build Coastguard Worker    sudo apt install -y libomp-dev; \
27*da0073e9SAndroid Build Coastguard Worker    fi
28*da0073e9SAndroid Build Coastguard Worker
29*da0073e9SAndroid Build Coastguard Worker
30*da0073e9SAndroid Build Coastguard Worker# Install cuda if version is specified
31*da0073e9SAndroid Build Coastguard WorkerARG CUDA_VERSION
32*da0073e9SAndroid Build Coastguard WorkerRUN if [ -n "$CUDA_VERSION" ]; then \
33*da0073e9SAndroid Build Coastguard Worker       conda install -y cuda -c "nvidia/label/cuda-${CUDA_VERSION}"; \
34*da0073e9SAndroid Build Coastguard Worker    fi
35