1#!/bin/bash 2# Copyright (c) Meta Platforms, Inc. and affiliates. 3# All rights reserved. 4# 5# This source code is licensed under the BSD-style license found in the 6# LICENSE file in the root directory of this source tree. 7 8set -exu 9 10IMAGE_NAME="$1" 11shift 12 13echo "Building ${IMAGE_NAME} Docker image" 14 15OS=ubuntu 16OS_VERSION=22.04 17CLANG_VERSION="" 18GCC_VERSION="" 19PYTHON_VERSION=3.10 20MINICONDA_VERSION=23.10.0-1 21BUCK2_VERSION=$(cat ci_commit_pins/buck2.txt) 22 23case "${IMAGE_NAME}" in 24 executorch-ubuntu-22.04-gcc9) 25 LINTRUNNER="" 26 GCC_VERSION=9 27 ;; 28 executorch-ubuntu-22.04-clang12) 29 LINTRUNNER="" 30 CLANG_VERSION=12 31 ;; 32 executorch-ubuntu-22.04-linter) 33 LINTRUNNER=yes 34 CLANG_VERSION=12 35 ;; 36 executorch-ubuntu-22.04-arm-sdk) 37 ARM_SDK=yes 38 CLANG_VERSION=12 39 ;; 40 executorch-ubuntu-22.04-qnn-sdk) 41 QNN_SDK=yes 42 CLANG_VERSION=12 43 ;; 44 executorch-ubuntu-22.04-clang12-android) 45 LINTRUNNER="" 46 CLANG_VERSION=12 47 # From https://developer.android.com/ndk/downloads 48 ANDROID_NDK_VERSION=r27b 49 ;; 50 *) 51 echo "Invalid image name ${IMAGE_NAME}" 52 exit 1 53esac 54 55TORCH_VERSION=$(cat ci_commit_pins/pytorch.txt) 56BUILD_DOCS=1 57 58# Copy requirements-lintrunner.txt from root to here 59cp ../../requirements-lintrunner.txt ./ 60 61# Copy arm setup script from root to here 62# TODO(huydhn): Figure out a way to rebuild the Docker image automatically 63# with a new image hash when the content here is updated 64cp -r ../../examples/arm/ ./arm 65 66docker build \ 67 --no-cache \ 68 --progress=plain \ 69 --build-arg "OS_VERSION=${OS_VERSION}" \ 70 --build-arg "CLANG_VERSION=${CLANG_VERSION}" \ 71 --build-arg "GCC_VERSION=${GCC_VERSION}" \ 72 --build-arg "PYTHON_VERSION=${PYTHON_VERSION}" \ 73 --build-arg "MINICONDA_VERSION=${MINICONDA_VERSION}" \ 74 --build-arg "TORCH_VERSION=${TORCH_VERSION}" \ 75 --build-arg "BUCK2_VERSION=${BUCK2_VERSION}" \ 76 --build-arg "LINTRUNNER=${LINTRUNNER:-}" \ 77 --build-arg "BUILD_DOCS=${BUILD_DOCS}" \ 78 --build-arg "ARM_SDK=${ARM_SDK:-}" \ 79 --build-arg "QNN_SDK=${QNN_SDK:-}" \ 80 --build-arg "ANDROID_NDK_VERSION=${ANDROID_NDK_VERSION:-}" \ 81 -f "${OS}"/Dockerfile \ 82 "$@" \ 83 . 84