# This automation builds a aarch64 Ubuntu container name: Build Container on: # Allows you to run this workflow manually from the Actions tag workflow_dispatch: push: branches: - main - development paths: - .github/workflows/build-container.yaml jobs: build-container: name: Build Ubuntu container for aarch64 runs-on: ubuntu-latest permissions: contents: read # We use ghcr.io to store the docker image cache for ARM builds packages: write steps: - name: Run build command (aarch64) uses: uraimo/run-on-arch-action@v2.5.1 with: env: | GITHUB_WORKFLOW: ${{ github.workflow }} # Sets the docker image to the name of the workflow arch: aarch64 distro: ubuntu22.04 githubToken: ${{ github.token }} shell: /bin/bash install: | ## Set variables. "env" not supported in install phase export CLANG_VER=12 export GCC_VER=9 export SCCACHE_VER=0.5.4 export CMAKE_VER=3.27.6 ## Install build dependancies from apt apt-get update apt-get install -y build-essential curl git libssl-dev libffi-dev libbz2-dev libgdbm-compat-dev libgdbm-dev liblzma-dev libreadline-dev libtool \ ninja-build python3 python3-pip tcl8.6-dev tk8.6-dev texinfo software-properties-common wget libc6 python3 -m pip install boto3 certifi # Install Clang/GCC at specific version apt-get install -y clang-${CLANG_VER} gcc-${GCC_VER} g++-${GCC_VER} update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${CLANG_VER} 10 update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-${CLANG_VER} 10 update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_VER} 10 update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-${GCC_VER} 10 ## Install sccache wget -qO- "https://github.com/mozilla/sccache/releases/download/v${SCCACHE_VER}/sccache-v${SCCACHE_VER}-aarch64-unknown-linux-musl.tar.gz" \ | tar xzf - -O --wildcards '*/sccache' > '/usr/local/bin/sccache' \ && chmod +x '/usr/local/bin/sccache' ## Install cmake wget -q "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VER}/cmake-${CMAKE_VER}-linux-aarch64.sh" \ -O /tmp/cmake-install.sh \ && chmod u+x /tmp/cmake-install.sh \ && mkdir /opt/cmake-${CMAKE_VER} \ && /tmp/cmake-install.sh --skip-license --prefix=/opt/cmake-${CMAKE_VER} \ && rm /tmp/cmake-install.sh \ && ln -s /opt/cmake-${CMAKE_VER}/bin/* /usr/local/bin rm -rf /var/lib/apt/lists/* # Add Docker's official GPG key: apt-get update sudo apt-get install ca-certificates curl sudo install -m 0755 -d /etc/apt/keyrings sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc sudo chmod a+r /etc/apt/keyrings/docker.asc # Add the repository to Apt sources: echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \ $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | \ tee /etc/apt/sources.list.d/docker.list > /dev/null apt-get update apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin apt-get install -y qemu-user-static binfmt-support update-binfmts --install qemu-aarch64 /usr/bin/qemu-aarch64-static --magic '\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7\x00' --mask '\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff' run: | lsb_release -a uname -a gcc --version g++ --version clang --version sccache --version cmake --version git --version python3 --version docker --version