Skip to content

Commit

Permalink
feat(docker/build.sh): support cross build (autowarefoundation#341)
Browse files Browse the repository at this point in the history
Signed-off-by: Kenji Miyake <[email protected]>
  • Loading branch information
kenji-miyake authored May 23, 2022
1 parent cf98e77 commit bbae2a7
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion docker/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,20 @@ set -e
SCRIPT_DIR=$(readlink -f "$(dirname "$0")")
WORKSPACE_ROOT="$SCRIPT_DIR/../"

# Set default platform
platform="linux/amd64"
if [ "$(uname -m)" = "aarch64" ]; then
platform="linux/arm64"
fi

# Override platform by arg
if [ "$1" = "amd64" ] || [ "$1" = "arm64" ]; then
platform="linux/$1"
fi

# Load env
source "$WORKSPACE_ROOT/amd64.env"
if [ "$(uname -m)" = "aarch64" ]; then
if [ "$platform" = "linux/arm64" ]; then
source "$WORKSPACE_ROOT/arm64.env"
fi

Expand All @@ -17,6 +28,7 @@ export BUILDKIT_STEP_LOG_MAX_SIZE=10000000
docker buildx bake --load --progress=plain -f "$SCRIPT_DIR/autoware-universe/docker-bake.hcl" \
--set "*.context=$WORKSPACE_ROOT" \
--set "*.ssh=default" \
--set "*.platform=$platform" \
--set "*.args.ROS_DISTRO=$rosdistro" \
--set "*.args.BASE_IMAGE=$base_image" \
--set "devel.tags=ghcr.io/autowarefoundation/autoware-universe:$rosdistro-latest" \
Expand Down

0 comments on commit bbae2a7

Please sign in to comment.