forked from canonical/identity-platform-admin-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·33 lines (26 loc) · 816 Bytes
/
build.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
#!/bin/sh
# The script requires:
# - rockcraft
# - skopeo with sudo privilege
# - yq
# - docker
set -e
rockcraft="rockcraft.yaml"
rockcraft_backup="rockcraft_bak.yaml"
restore() {
mv "$rockcraft_backup" "$rockcraft"
rm -f "$rockcraft_backup"
}
trap 'restore' INT TERM EXIT
# The ROCK image needs certain utilities to
# - create OpenFGA store and authorization model
# - export OpenFGA store ID and authorization model ID to Admin UI service
cp "$rockcraft" "$rockcraft_backup"
yq -i \
'.base = "[email protected]", .parts |= ({"utils": {"plugin": "nil", "stage-packages": ["curl", "jq"]}} + .)' \
"$rockcraft"
rockcraft pack -v
sudo skopeo --insecure-policy \
copy "oci-archive:identity-platform-admin-ui_$(yq -r '.version' rockcraft.yaml)_amd64.rock" \
docker-daemon:"$IMAGE"
docker push "$IMAGE"