-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
c0rv4x
committed
Oct 18, 2024
1 parent
18f2845
commit 7b34702
Showing
2 changed files
with
27 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,32 @@ | ||
#!/usr/bin/env bash | ||
|
||
# This shell script exists for building docker image. | ||
# Docker image includes HO(Host Orchestrator) inside, | ||
# so it could execute CF instance with API in HO. | ||
# This shell script exists for building Docker image using Docker Buildx. | ||
# The image includes HO (Host Orchestrator) inside, so it can execute CF instance with API in HO. | ||
|
||
script_location=`realpath -s $(dirname ${BASH_SOURCE[0]})` | ||
android_cuttlefish_root_dir=$(realpath -s $script_location/..) | ||
set -e | ||
|
||
script_location=$(realpath -s $(dirname "${BASH_SOURCE[0]}")) | ||
android_cuttlefish_root_dir=$(realpath -s "$script_location/..") | ||
|
||
if [[ "$1" == "" ]]; then | ||
tag=cuttlefish-orchestration | ||
tag="cuttlefish-orchestration" | ||
else | ||
tag=$1 | ||
tag="$1" | ||
fi | ||
|
||
# Build docker image | ||
pushd $android_cuttlefish_root_dir | ||
docker build \ | ||
# Use the PLATFORM environment variable, defaulting to linux/amd64 if not set | ||
platforms="${PLATFORM:-linux/amd64}" | ||
|
||
# Set up Docker Buildx if not already set up | ||
docker buildx create --use || true | ||
|
||
# Build the Docker image using Buildx for x86_64 and arm64 platforms | ||
pushd "$android_cuttlefish_root_dir" | ||
docker buildx build \ | ||
--platform "$platforms" \ | ||
--force-rm \ | ||
--no-cache \ | ||
-f docker/Dockerfile \ | ||
-t $tag \ | ||
. | ||
-t "$tag" \ | ||
--load . | ||
popd |