From 644c02172fb7d90dfd2c35ffedbe450f491d53fc Mon Sep 17 00:00:00 2001 From: haiqi96 <14502009+haiqi96@users.noreply.github.com> Date: Mon, 5 Feb 2024 17:30:44 +0000 Subject: [PATCH 1/2] support arm64 container --- .../clp-execution-base-focal/build.sh | 13 ++++++++++++- .../clp-execution-base-jammy/Dockerfile | 15 +++++++++++++++ .../clp-execution-base-jammy/build.sh | 17 +++++++++++++++++ .../setup-scripts/install-prebuilt-packages.sh | 16 ++++++++++++++++ 4 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 tools/docker-images/clp-execution-base-jammy/Dockerfile create mode 100755 tools/docker-images/clp-execution-base-jammy/build.sh create mode 100755 tools/docker-images/clp-execution-base-jammy/setup-scripts/install-prebuilt-packages.sh diff --git a/tools/docker-images/clp-execution-base-focal/build.sh b/tools/docker-images/clp-execution-base-focal/build.sh index e8b1cde88..af954768a 100755 --- a/tools/docker-images/clp-execution-base-focal/build.sh +++ b/tools/docker-images/clp-execution-base-focal/build.sh @@ -3,4 +3,15 @@ script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" repo_root=${script_dir}/../../../ -docker build -t clp-execution-x86-ubuntu-focal:dev ${repo_root} --file ${script_dir}/Dockerfile +arch=$(uname -m) + +if [ "$arch" == "x86_64" ]; then + arch_name="x86" +elif [ "$arch" == "aarch64" ]; then + arch_name="arm64" +else + echo "Error: Unsupported architecture - $arch" + exit 1 +fi + +docker build -t clp-execution-${arch_name}-ubuntu-focal:dev ${repo_root} --file ${script_dir}/Dockerfile diff --git a/tools/docker-images/clp-execution-base-jammy/Dockerfile b/tools/docker-images/clp-execution-base-jammy/Dockerfile new file mode 100644 index 000000000..37efa356e --- /dev/null +++ b/tools/docker-images/clp-execution-base-jammy/Dockerfile @@ -0,0 +1,15 @@ +FROM ubuntu:jammy + +WORKDIR /root + +RUN mkdir -p ./tools/docker-images/clp-execution-base-jammy +ADD ./tools/docker-images/clp-execution-base-jammy/setup-scripts ./tools/docker-images/clp-execution-base-jammy/setup-scripts + +RUN mkdir -p ./tools/scripts/lib_install +ADD ./components/core/tools/scripts/lib_install ./tools/scripts/lib_install + +RUN ./tools/docker-images/clp-execution-base-jammy/setup-scripts/install-prebuilt-packages.sh + +# Reset the working directory so that it's accessible by any user who runs the +# container +WORKDIR / diff --git a/tools/docker-images/clp-execution-base-jammy/build.sh b/tools/docker-images/clp-execution-base-jammy/build.sh new file mode 100755 index 000000000..480ad3572 --- /dev/null +++ b/tools/docker-images/clp-execution-base-jammy/build.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +repo_root=${script_dir}/../../../ + +arch=$(uname -m) + +if [ "$arch" == "x86_64" ]; then + arch_name="x86" +elif [ "$arch" == "aarch64" ]; then + arch_name="arm64" +else + echo "Error: Unsupported architecture - $arch" + exit 1 +fi + +docker build -t clp-execution-x86-ubuntu-focal:dev ${repo_root} --file ${script_dir}/Dockerfile diff --git a/tools/docker-images/clp-execution-base-jammy/setup-scripts/install-prebuilt-packages.sh b/tools/docker-images/clp-execution-base-jammy/setup-scripts/install-prebuilt-packages.sh new file mode 100755 index 000000000..90306f8db --- /dev/null +++ b/tools/docker-images/clp-execution-base-jammy/setup-scripts/install-prebuilt-packages.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +# Exit on any error +set -e + +# Error on undefined variable +set -u + +apt-get update +DEBIAN_FRONTEND=noninteractive apt-get install -y \ + checkinstall \ + curl \ + libmariadb-dev \ + python3 \ + rsync \ + zstd From 4e857ecb81bec1a9885cdc61d6bb90640534b0d2 Mon Sep 17 00:00:00 2001 From: haiqi96 <14502009+haiqi96@users.noreply.github.com> Date: Mon, 5 Feb 2024 22:10:06 +0000 Subject: [PATCH 2/2] fixes --- .../clp-execution-base-focal/build.sh | 15 +++++++++++---- .../setup-scripts/install-prebuilt-packages.sh | 2 +- .../clp-execution-base-jammy/build.sh | 15 +++++++++++---- .../setup-scripts/install-prebuilt-packages.sh | 2 +- 4 files changed, 24 insertions(+), 10 deletions(-) diff --git a/tools/docker-images/clp-execution-base-focal/build.sh b/tools/docker-images/clp-execution-base-focal/build.sh index af954768a..cecd834a3 100755 --- a/tools/docker-images/clp-execution-base-focal/build.sh +++ b/tools/docker-images/clp-execution-base-focal/build.sh @@ -1,17 +1,24 @@ -#!/bin/bash +#!/usr/bin/env bash + +# Exit on any error +set -e + +# Error on undefined variable +set -u script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" repo_root=${script_dir}/../../../ arch=$(uname -m) -if [ "$arch" == "x86_64" ]; then +if [ "$arch" = "x86_64" ]; then arch_name="x86" -elif [ "$arch" == "aarch64" ]; then +elif [ "$arch" = "aarch64" ]; then arch_name="arm64" else echo "Error: Unsupported architecture - $arch" exit 1 fi -docker build -t clp-execution-${arch_name}-ubuntu-focal:dev ${repo_root} --file ${script_dir}/Dockerfile +docker build -t clp-execution-${arch_name}-ubuntu-focal:dev ${repo_root} \ + --file ${script_dir}/Dockerfile diff --git a/tools/docker-images/clp-execution-base-focal/setup-scripts/install-prebuilt-packages.sh b/tools/docker-images/clp-execution-base-focal/setup-scripts/install-prebuilt-packages.sh index 90306f8db..cab32f820 100755 --- a/tools/docker-images/clp-execution-base-focal/setup-scripts/install-prebuilt-packages.sh +++ b/tools/docker-images/clp-execution-base-focal/setup-scripts/install-prebuilt-packages.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Exit on any error set -e diff --git a/tools/docker-images/clp-execution-base-jammy/build.sh b/tools/docker-images/clp-execution-base-jammy/build.sh index 480ad3572..fab7424b0 100755 --- a/tools/docker-images/clp-execution-base-jammy/build.sh +++ b/tools/docker-images/clp-execution-base-jammy/build.sh @@ -1,17 +1,24 @@ -#!/bin/bash +#!/usr/bin/env bash + +# Exit on any error +set -e + +# Error on undefined variable +set -u script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" repo_root=${script_dir}/../../../ arch=$(uname -m) -if [ "$arch" == "x86_64" ]; then +if [ "$arch" = "x86_64" ]; then arch_name="x86" -elif [ "$arch" == "aarch64" ]; then +elif [ "$arch" = "aarch64" ]; then arch_name="arm64" else echo "Error: Unsupported architecture - $arch" exit 1 fi -docker build -t clp-execution-x86-ubuntu-focal:dev ${repo_root} --file ${script_dir}/Dockerfile +docker build -t clp-execution-${arch_name}-ubuntu-jammy:dev ${repo_root} \ + --file ${script_dir}/Dockerfile diff --git a/tools/docker-images/clp-execution-base-jammy/setup-scripts/install-prebuilt-packages.sh b/tools/docker-images/clp-execution-base-jammy/setup-scripts/install-prebuilt-packages.sh index 90306f8db..cab32f820 100755 --- a/tools/docker-images/clp-execution-base-jammy/setup-scripts/install-prebuilt-packages.sh +++ b/tools/docker-images/clp-execution-base-jammy/setup-scripts/install-prebuilt-packages.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Exit on any error set -e