Skip to content

Commit

Permalink
updated build scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomas Baca authored and Tomas Baca committed Jan 22, 2025
1 parent 83c5786 commit 8f4b31c
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 35 deletions.
8 changes: 0 additions & 8 deletions docker/hailo_ai/build_arm64.sh

This file was deleted.

48 changes: 48 additions & 0 deletions docker/hailo_ai/build_image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/bash

# get the path to this script
MY_PATH=`dirname "$0"`
MY_PATH=`( cd "$MY_PATH" && pwd )`

cd ${MY_PATH}

## --------------------------------------------------------------
## | setup |
## --------------------------------------------------------------

LOCAL_TAG=mrs_uav_system:1.5.0_hailo_ai
REGISTRY=ctumrs

# single-platform image can be stored locally
# ARCH=linux/amd64
ARCH=linux/arm64
OUTPUT="--output type=docker"

# multi-platform image can not be stored locally, needs to be pushed
# ARCH=linux/arm64,linux/amd64
# OUTPUT="--push"

## --------------------------------------------------------------
## | build |
## --------------------------------------------------------------

# multiplatform builder
BUILDER=container-builder

# get info about an existing builder
container_builder_info=$(docker buildx inspect ${BUILDER})

if [[ "$?" == "0" ]]; then
# activate the builder if it exists
docker buildx use ${BUILDER}
else
# create the builder if it does not exist
docker buildx create --name ${BUILDER} --driver docker-container --bootstrap --use
fi

# build the docker image using the builder and export the results to the local docker registry
docker buildx build . --file Dockerfile --tag $REGISTRY/$LOCAL_TAG --platform=${ARCH} ${OUTPUT}

echo ""
echo "$0: shared data were packed into '$LOCAL_TAG'"
echo ""
32 changes: 23 additions & 9 deletions docker/shared_data/camera_tests/build_image.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
#!/bin/bash

set -e

trap 'last_command=$current_command; current_command=$BASH_COMMAND' DEBUG
trap 'echo "$0: \"${last_command}\" command failed with exit code $?"' ERR

# get the path to this script
MY_PATH=`dirname "$0"`
MY_PATH=`( cd "$MY_PATH" && pwd )`
Expand All @@ -18,16 +13,35 @@ cd ${MY_PATH}
LOCAL_TAG=robofly:shared_data_camera_tests
REGISTRY=fly4future

ARCH=arm64 # robofly
# ARCH=amd64
# single-platform image can be stored locally
# ARCH=linux/amd64
ARCH=linux/arm64
OUTPUT="--output type=docker"

# multi-platform image can not be stored locally, needs to be pushed
# ARCH=linux/arm64,linux/amd64
# OUTPUT="--push"

## --------------------------------------------------------------
## | build |
## --------------------------------------------------------------

docker buildx use default
# multiplatform builder
BUILDER=container-builder

# get info about an existing builder
container_builder_info=$(docker buildx inspect ${BUILDER})

if [[ "$?" == "0" ]]; then
# activate the builder if it exists
docker buildx use ${BUILDER}
else
# create the builder if it does not exist
docker buildx create --name ${BUILDER} --driver docker-container --bootstrap --use
fi

docker buildx build . --file Dockerfile --tag $REGISTRY/$LOCAL_TAG --platform=linux/${ARCH}
# build the docker image using the builder and export the results to the local docker registry
docker buildx build . --file Dockerfile --tag $REGISTRY/$LOCAL_TAG --platform=${ARCH} ${OUTPUT}

echo ""
echo "$0: shared data were packed into '$LOCAL_TAG'"
Expand Down
32 changes: 23 additions & 9 deletions docker/shared_data/gnss/build_image.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
#!/bin/bash

set -e

trap 'last_command=$current_command; current_command=$BASH_COMMAND' DEBUG
trap 'echo "$0: \"${last_command}\" command failed with exit code $?"' ERR

# get the path to this script
MY_PATH=`dirname "$0"`
MY_PATH=`( cd "$MY_PATH" && pwd )`
Expand All @@ -18,16 +13,35 @@ cd ${MY_PATH}
LOCAL_TAG=robofly:shared_data_gnss
REGISTRY=fly4future

ARCH=arm64 # robofly
# ARCH=amd64
# single-platform image can be stored locally
# ARCH=linux/amd64
ARCH=linux/arm64
OUTPUT="--output type=docker"

# multi-platform image can not be stored locally, needs to be pushed
# ARCH=linux/arm64,linux/amd64
# OUTPUT="--push"

## --------------------------------------------------------------
## | build |
## --------------------------------------------------------------

docker buildx use default
# multiplatform builder
BUILDER=container-builder

# get info about an existing builder
container_builder_info=$(docker buildx inspect ${BUILDER})

if [[ "$?" == "0" ]]; then
# activate the builder if it exists
docker buildx use ${BUILDER}
else
# create the builder if it does not exist
docker buildx create --name ${BUILDER} --driver docker-container --bootstrap --use
fi

docker buildx build . --file Dockerfile --tag $REGISTRY/$LOCAL_TAG --platform=linux/${ARCH} --no-cache
# build the docker image using the builder and export the results to the local docker registry
docker buildx build . --file Dockerfile --tag $REGISTRY/$LOCAL_TAG --platform=${ARCH} ${OUTPUT}

echo ""
echo "$0: shared data were packed into '$LOCAL_TAG'"
Expand Down
32 changes: 23 additions & 9 deletions docker/shared_data/vio/build_image.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
#!/bin/bash

set -e

trap 'last_command=$current_command; current_command=$BASH_COMMAND' DEBUG
trap 'echo "$0: \"${last_command}\" command failed with exit code $?"' ERR

# get the path to this script
MY_PATH=`dirname "$0"`
MY_PATH=`( cd "$MY_PATH" && pwd )`
Expand All @@ -18,16 +13,35 @@ cd ${MY_PATH}
LOCAL_TAG=robofly:shared_data_vio
REGISTRY=fly4future

ARCH=arm64 # robofly
# ARCH=amd64
# single-platform image can be stored locally
# ARCH=linux/amd64
ARCH=linux/arm64
OUTPUT="--output type=docker"

# multi-platform image can not be stored locally, needs to be pushed
# ARCH=linux/arm64,linux/amd64
# OUTPUT="--push"

## --------------------------------------------------------------
## | build |
## --------------------------------------------------------------

docker buildx use default
# multiplatform builder
BUILDER=container-builder

# get info about an existing builder
container_builder_info=$(docker buildx inspect ${BUILDER})

if [[ "$?" == "0" ]]; then
# activate the builder if it exists
docker buildx use ${BUILDER}
else
# create the builder if it does not exist
docker buildx create --name ${BUILDER} --driver docker-container --bootstrap --use
fi

docker buildx build . --file Dockerfile --tag $REGISTRY/$LOCAL_TAG --platform=linux/${ARCH}
# build the docker image using the builder and export the results to the local docker registry
docker buildx build . --file Dockerfile --tag $REGISTRY/$LOCAL_TAG --platform=${ARCH} ${OUTPUT}

echo ""
echo "$0: shared data were packed into '$LOCAL_TAG'"
Expand Down

0 comments on commit 8f4b31c

Please sign in to comment.