-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcrossBuild.sh
More file actions
28 lines (23 loc) · 878 Bytes
/
crossBuild.sh
File metadata and controls
28 lines (23 loc) · 878 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
vehicleType=$1
version=$2
buildArgs="--build-arg VERSION=${version}"
if [[ "$vehicleType" == "" || "$vehicleType" == "copter" ]]; then
echo "Building ArduCopter"
vehicleType="copter"
elif [[ "$vehicleType" == "plane" || "$vehicleType" == "ArduPlane" ]]; then
echo "Building ArduPlane"
vehicleType="plane"
buildArgs="${buildArgs} --build-arg VEHICLE_TYPE=1"
else
echo "Invalid vehicle type, using ArduCopter"
vehicleType="copter"
fi
# Add QEMU stuff
docker run --privileged --rm tonistiigi/binfmt --install arm64,arm
# Create and bootstrap builder
docker buildx create --name mubuilder --use
docker buildx inspect --bootstrap
# Build and push images
docker buildx build ${buildArgs} --tag ubcuas/uasitl:${vehicleType}-arm-${version} --output type=image arm/ --platform "linux/arm64,linux/arm/v7"
# Cleanup
docker buildx rm --keep-state mubuilder