xref: /aosp_15_r20/external/pytorch/.ci/docker/linter-cuda/Dockerfile (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1*da0073e9SAndroid Build Coastguard WorkerARG UBUNTU_VERSION
2*da0073e9SAndroid Build Coastguard Worker
3*da0073e9SAndroid Build Coastguard WorkerFROM ubuntu:${UBUNTU_VERSION}
4*da0073e9SAndroid Build Coastguard Worker
5*da0073e9SAndroid Build Coastguard WorkerARG UBUNTU_VERSION
6*da0073e9SAndroid Build Coastguard Worker
7*da0073e9SAndroid Build Coastguard WorkerENV DEBIAN_FRONTEND noninteractive
8*da0073e9SAndroid Build Coastguard Worker
9*da0073e9SAndroid Build Coastguard Worker# Install common dependencies (so that this step can be cached separately)
10*da0073e9SAndroid Build Coastguard WorkerCOPY ./common/install_base.sh install_base.sh
11*da0073e9SAndroid Build Coastguard WorkerRUN bash ./install_base.sh && rm install_base.sh
12*da0073e9SAndroid Build Coastguard Worker
13*da0073e9SAndroid Build Coastguard Worker# Install missing libomp-dev
14*da0073e9SAndroid Build Coastguard WorkerRUN apt-get update && apt-get install -y --no-install-recommends libomp-dev && apt-get autoclean && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
15*da0073e9SAndroid Build Coastguard Worker
16*da0073e9SAndroid Build Coastguard Worker# Install user
17*da0073e9SAndroid Build Coastguard WorkerCOPY ./common/install_user.sh install_user.sh
18*da0073e9SAndroid Build Coastguard WorkerRUN bash ./install_user.sh && rm install_user.sh
19*da0073e9SAndroid Build Coastguard Worker
20*da0073e9SAndroid Build Coastguard Worker# Install conda and other packages (e.g., numpy, pytest)
21*da0073e9SAndroid Build Coastguard WorkerARG ANACONDA_PYTHON_VERSION
22*da0073e9SAndroid Build Coastguard WorkerARG CONDA_CMAKE
23*da0073e9SAndroid Build Coastguard WorkerENV ANACONDA_PYTHON_VERSION=$ANACONDA_PYTHON_VERSION
24*da0073e9SAndroid Build Coastguard WorkerENV PATH /opt/conda/envs/py_$ANACONDA_PYTHON_VERSION/bin:/opt/conda/bin:$PATH
25*da0073e9SAndroid Build Coastguard WorkerCOPY requirements-ci.txt /opt/conda/requirements-ci.txt
26*da0073e9SAndroid Build Coastguard WorkerCOPY ./common/install_conda.sh install_conda.sh
27*da0073e9SAndroid Build Coastguard WorkerCOPY ./common/common_utils.sh common_utils.sh
28*da0073e9SAndroid Build Coastguard WorkerRUN bash ./install_conda.sh && rm install_conda.sh common_utils.sh /opt/conda/requirements-ci.txt
29*da0073e9SAndroid Build Coastguard Worker
30*da0073e9SAndroid Build Coastguard Worker# Install cuda and cudnn
31*da0073e9SAndroid Build Coastguard WorkerARG CUDA_VERSION
32*da0073e9SAndroid Build Coastguard WorkerCOPY ./common/install_cuda.sh install_cuda.sh
33*da0073e9SAndroid Build Coastguard WorkerRUN bash ./install_cuda.sh ${CUDA_VERSION} && rm install_cuda.sh
34*da0073e9SAndroid Build Coastguard WorkerENV DESIRED_CUDA ${CUDA_VERSION}
35*da0073e9SAndroid Build Coastguard WorkerENV PATH /usr/local/nvidia/bin:/usr/local/cuda/bin:$PATH
36*da0073e9SAndroid Build Coastguard Worker
37*da0073e9SAndroid Build Coastguard Worker# Note that Docker build forbids copying file outside the build context
38*da0073e9SAndroid Build Coastguard WorkerCOPY ./common/install_linter.sh install_linter.sh
39*da0073e9SAndroid Build Coastguard WorkerCOPY ./common/common_utils.sh common_utils.sh
40*da0073e9SAndroid Build Coastguard WorkerRUN bash ./install_linter.sh
41*da0073e9SAndroid Build Coastguard WorkerRUN rm install_linter.sh common_utils.sh
42*da0073e9SAndroid Build Coastguard Worker
43*da0073e9SAndroid Build Coastguard WorkerUSER jenkins
44*da0073e9SAndroid Build Coastguard WorkerCMD ["bash"]
45