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 WorkerARG CLANG_VERSION 10*da0073e9SAndroid Build Coastguard Worker 11*da0073e9SAndroid Build Coastguard Worker# Install common dependencies (so that this step can be cached separately) 12*da0073e9SAndroid Build Coastguard WorkerCOPY ./common/install_base.sh install_base.sh 13*da0073e9SAndroid Build Coastguard WorkerRUN bash ./install_base.sh && rm install_base.sh 14*da0073e9SAndroid Build Coastguard Worker 15*da0073e9SAndroid Build Coastguard Worker# Install clang 16*da0073e9SAndroid Build Coastguard WorkerARG LLVMDEV 17*da0073e9SAndroid Build Coastguard WorkerCOPY ./common/install_clang.sh install_clang.sh 18*da0073e9SAndroid Build Coastguard WorkerRUN bash ./install_clang.sh && rm install_clang.sh 19*da0073e9SAndroid Build Coastguard Worker 20*da0073e9SAndroid Build Coastguard Worker# Install user 21*da0073e9SAndroid Build Coastguard WorkerCOPY ./common/install_user.sh install_user.sh 22*da0073e9SAndroid Build Coastguard WorkerRUN bash ./install_user.sh && rm install_user.sh 23*da0073e9SAndroid Build Coastguard Worker 24*da0073e9SAndroid Build Coastguard Worker# Install katex 25*da0073e9SAndroid Build Coastguard WorkerARG KATEX 26*da0073e9SAndroid Build Coastguard WorkerCOPY ./common/install_docs_reqs.sh install_docs_reqs.sh 27*da0073e9SAndroid Build Coastguard WorkerRUN bash ./install_docs_reqs.sh && rm install_docs_reqs.sh 28*da0073e9SAndroid Build Coastguard Worker 29*da0073e9SAndroid Build Coastguard Worker# Install conda and other packages (e.g., numpy, pytest) 30*da0073e9SAndroid Build Coastguard WorkerARG ANACONDA_PYTHON_VERSION 31*da0073e9SAndroid Build Coastguard WorkerARG CONDA_CMAKE 32*da0073e9SAndroid Build Coastguard WorkerARG DOCS 33*da0073e9SAndroid Build Coastguard WorkerARG BUILD_ENVIRONMENT 34*da0073e9SAndroid Build Coastguard WorkerENV ANACONDA_PYTHON_VERSION=$ANACONDA_PYTHON_VERSION 35*da0073e9SAndroid Build Coastguard WorkerENV PATH /opt/conda/envs/py_$ANACONDA_PYTHON_VERSION/bin:/opt/conda/bin:$PATH 36*da0073e9SAndroid Build Coastguard WorkerENV DOCS=$DOCS 37*da0073e9SAndroid Build Coastguard WorkerCOPY requirements-ci.txt requirements-docs.txt /opt/conda/ 38*da0073e9SAndroid Build Coastguard WorkerCOPY ./common/install_conda.sh install_conda.sh 39*da0073e9SAndroid Build Coastguard WorkerCOPY ./common/common_utils.sh common_utils.sh 40*da0073e9SAndroid Build Coastguard WorkerRUN bash ./install_conda.sh && rm install_conda.sh common_utils.sh /opt/conda/requirements-ci.txt /opt/conda/requirements-docs.txt 41*da0073e9SAndroid Build Coastguard Worker 42*da0073e9SAndroid Build Coastguard Worker# Install gcc 43*da0073e9SAndroid Build Coastguard WorkerARG GCC_VERSION 44*da0073e9SAndroid Build Coastguard WorkerCOPY ./common/install_gcc.sh install_gcc.sh 45*da0073e9SAndroid Build Coastguard WorkerRUN bash ./install_gcc.sh && rm install_gcc.sh 46*da0073e9SAndroid Build Coastguard Worker 47*da0073e9SAndroid Build Coastguard Worker# Install lcov for C++ code coverage 48*da0073e9SAndroid Build Coastguard WorkerCOPY ./common/install_lcov.sh install_lcov.sh 49*da0073e9SAndroid Build Coastguard WorkerRUN bash ./install_lcov.sh && rm install_lcov.sh 50*da0073e9SAndroid Build Coastguard Worker 51*da0073e9SAndroid Build Coastguard WorkerCOPY ./common/install_openssl.sh install_openssl.sh 52*da0073e9SAndroid Build Coastguard WorkerRUN bash ./install_openssl.sh 53*da0073e9SAndroid Build Coastguard WorkerENV OPENSSL_ROOT_DIR /opt/openssl 54*da0073e9SAndroid Build Coastguard WorkerENV OPENSSL_DIR /opt/openssl 55*da0073e9SAndroid Build Coastguard WorkerRUN rm install_openssl.sh 56*da0073e9SAndroid Build Coastguard Worker 57*da0073e9SAndroid Build Coastguard WorkerARG INDUCTOR_BENCHMARKS 58*da0073e9SAndroid Build Coastguard WorkerCOPY ./common/install_inductor_benchmark_deps.sh install_inductor_benchmark_deps.sh 59*da0073e9SAndroid Build Coastguard WorkerCOPY ./common/common_utils.sh common_utils.sh 60*da0073e9SAndroid Build Coastguard WorkerCOPY ci_commit_pins/huggingface.txt huggingface.txt 61*da0073e9SAndroid Build Coastguard WorkerCOPY ci_commit_pins/timm.txt timm.txt 62*da0073e9SAndroid Build Coastguard WorkerRUN if [ -n "${INDUCTOR_BENCHMARKS}" ]; then bash ./install_inductor_benchmark_deps.sh; fi 63*da0073e9SAndroid Build Coastguard WorkerRUN rm install_inductor_benchmark_deps.sh common_utils.sh timm.txt huggingface.txt 64*da0073e9SAndroid Build Coastguard Worker 65*da0073e9SAndroid Build Coastguard Worker# Install XPU Dependencies 66*da0073e9SAndroid Build Coastguard WorkerARG XPU_VERSION 67*da0073e9SAndroid Build Coastguard WorkerCOPY ./common/install_xpu.sh install_xpu.sh 68*da0073e9SAndroid Build Coastguard WorkerRUN bash ./install_xpu.sh && rm install_xpu.sh 69*da0073e9SAndroid Build Coastguard Worker 70*da0073e9SAndroid Build Coastguard WorkerARG TRITON 71*da0073e9SAndroid Build Coastguard Worker# Install triton, this needs to be done before sccache because the latter will 72*da0073e9SAndroid Build Coastguard Worker# try to reach out to S3, which docker build runners don't have access 73*da0073e9SAndroid Build Coastguard WorkerCOPY ./common/install_triton.sh install_triton.sh 74*da0073e9SAndroid Build Coastguard WorkerCOPY ./common/common_utils.sh common_utils.sh 75*da0073e9SAndroid Build Coastguard WorkerCOPY ci_commit_pins/triton-xpu.txt triton-xpu.txt 76*da0073e9SAndroid Build Coastguard WorkerCOPY triton_version.txt triton_version.txt 77*da0073e9SAndroid Build Coastguard WorkerRUN if [ -n "${TRITON}" ]; then bash ./install_triton.sh; fi 78*da0073e9SAndroid Build Coastguard WorkerRUN rm install_triton.sh common_utils.sh triton-xpu.txt triton_version.txt 79*da0073e9SAndroid Build Coastguard Worker 80*da0073e9SAndroid Build Coastguard Worker# (optional) Install database packages like LMDB and LevelDB 81*da0073e9SAndroid Build Coastguard WorkerARG DB 82*da0073e9SAndroid Build Coastguard WorkerCOPY ./common/install_db.sh install_db.sh 83*da0073e9SAndroid Build Coastguard WorkerRUN if [ -n "${DB}" ]; then bash ./install_db.sh; fi 84*da0073e9SAndroid Build Coastguard WorkerRUN rm install_db.sh 85*da0073e9SAndroid Build Coastguard WorkerENV INSTALLED_DB ${DB} 86*da0073e9SAndroid Build Coastguard Worker 87*da0073e9SAndroid Build Coastguard Worker# (optional) Install vision packages like OpenCV 88*da0073e9SAndroid Build Coastguard WorkerARG VISION 89*da0073e9SAndroid Build Coastguard WorkerCOPY ./common/install_vision.sh ./common/cache_vision_models.sh ./common/common_utils.sh ./ 90*da0073e9SAndroid Build Coastguard WorkerRUN if [ -n "${VISION}" ]; then bash ./install_vision.sh; fi 91*da0073e9SAndroid Build Coastguard WorkerRUN rm install_vision.sh cache_vision_models.sh common_utils.sh 92*da0073e9SAndroid Build Coastguard WorkerENV INSTALLED_VISION ${VISION} 93*da0073e9SAndroid Build Coastguard Worker 94*da0073e9SAndroid Build Coastguard Worker# (optional) Install non-default CMake version 95*da0073e9SAndroid Build Coastguard WorkerARG CMAKE_VERSION 96*da0073e9SAndroid Build Coastguard WorkerCOPY ./common/install_cmake.sh install_cmake.sh 97*da0073e9SAndroid Build Coastguard WorkerRUN if [ -n "${CMAKE_VERSION}" ]; then bash ./install_cmake.sh; fi 98*da0073e9SAndroid Build Coastguard WorkerRUN rm install_cmake.sh 99*da0073e9SAndroid Build Coastguard Worker 100*da0073e9SAndroid Build Coastguard Worker# (optional) Install non-default Ninja version 101*da0073e9SAndroid Build Coastguard WorkerARG NINJA_VERSION 102*da0073e9SAndroid Build Coastguard WorkerCOPY ./common/install_ninja.sh install_ninja.sh 103*da0073e9SAndroid Build Coastguard WorkerRUN if [ -n "${NINJA_VERSION}" ]; then bash ./install_ninja.sh; fi 104*da0073e9SAndroid Build Coastguard WorkerRUN rm install_ninja.sh 105*da0073e9SAndroid Build Coastguard Worker 106*da0073e9SAndroid Build Coastguard Worker# Install ccache/sccache (do this last, so we get priority in PATH) 107*da0073e9SAndroid Build Coastguard WorkerCOPY ./common/install_cache.sh install_cache.sh 108*da0073e9SAndroid Build Coastguard WorkerENV PATH /opt/cache/bin:$PATH 109*da0073e9SAndroid Build Coastguard WorkerRUN bash ./install_cache.sh && rm install_cache.sh 110*da0073e9SAndroid Build Coastguard Worker 111*da0073e9SAndroid Build Coastguard Worker# Include BUILD_ENVIRONMENT environment variable in image 112*da0073e9SAndroid Build Coastguard WorkerARG BUILD_ENVIRONMENT 113*da0073e9SAndroid Build Coastguard WorkerENV BUILD_ENVIRONMENT ${BUILD_ENVIRONMENT} 114*da0073e9SAndroid Build Coastguard Worker 115*da0073e9SAndroid Build Coastguard Worker# Install LLVM dev version (Defined in the pytorch/builder github repository) 116*da0073e9SAndroid Build Coastguard WorkerCOPY --from=pytorch/llvm:9.0.1 /opt/llvm /opt/llvm 117*da0073e9SAndroid Build Coastguard Worker 118*da0073e9SAndroid Build Coastguard WorkerUSER jenkins 119*da0073e9SAndroid Build Coastguard WorkerCMD ["bash"] 120