-
Notifications
You must be signed in to change notification settings - Fork 0
/
build
executable file
·42 lines (33 loc) · 1.05 KB
/
build
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
42
#!/usr/bin/env bash
set -eufo pipefail
native_arch="$(podman system info --format json | jq -r '.host.arch')"
arch="$native_arch"
while [ $# -gt 0 ]; do
case "$1" in
--arch)
arch="$2"
shift 2
;;
*)
break
;;
esac
done
podman pull --arch "$native_arch" debian
podman build --arch "$native_arch" --tag unbase_oci:dev .
if [ "$arch" = "$native_arch" ]; then
podman tag unbase_oci:dev "unbase_oci:dev-$arch"
else
podman pull --arch "$arch" debian
podman build --arch "$arch" --tag "unbase_oci:dev-$arch" .
fi
podman save --format oci-archive debian > debian.oci
podman save --format oci-archive "unbase_oci:dev-$arch" > unbase_oci_dev.oci
./unbase_oci --container-image unbase_oci:dev --include include --exclude exclude --ldd-dependencies --print-tree debian.oci unbase_oci_dev.oci unbase_oci.oci
image="$(podman load < unbase_oci.oci | awk '{ print $NF }')"
rm debian.oci unbase_oci_dev.oci unbase_oci.oci
podman tag "$image" "unbase_oci:$arch"
if [ "$arch" = "$native_arch" ]; then
podman tag "$image" unbase_oci
fi
podman image list "$image"