forked from balena-labs-projects/dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-images.sh
executable file
·41 lines (31 loc) · 1.1 KB
/
build-images.sh
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
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash
set -e
function build_and_push_image () {
local BALENA_ARCH=$1
local PLATFORM=$2
TAG=$DOCKER_REPO/dashboard:$BALENA_ARCH-$VERSION
echo "Building for $BALENA_ARCH, platform $PLATFORM, pushing to $TAG"
docker buildx build . --pull \
--build-arg BALENA_ARCH=$BALENA_ARCH \
--platform $PLATFORM \
--file Dockerfile.template \
--tag $TAG --load
echo "Publishing..."
docker push $TAG
}
function create_and_push_manifest() {
docker manifest create $DOCKER_REPO/dashboard:latest \
--amend $DOCKER_REPO/dashboard:aarch64-$VERSION \
--amend $DOCKER_REPO/dashboard:armv7hf-$VERSION \
--amend $DOCKER_REPO/dashboard:rpi-$VERSION \
--amend $DOCKER_REPO/dashboard:amd64-$VERSION \
docker manifest push $DOCKER_REPO/dashboard:latest
}
# YOu can pass in a repo (such as a test docker repo) or accept the default
DOCKER_REPO=${1:-balenablocks}
VERSION=${2:-$(<VERSION)}
build_and_push_image "aarch64" "linux/arm64"
build_and_push_image "armv7hf" "linux/arm/v7"
build_and_push_image "rpi" "linux/arm/v6"
build_and_push_image "amd64" "linux/amd64"
create_and_push_manifest