Last active
May 28, 2023 20:21
-
-
Save raro28/b9f7393aa12d3f1c4dc87387780edc6c to your computer and use it in GitHub Desktop.
Build Taiga
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/sh | |
#https://medium.com/oracledevs/building-multi-architecture-containers-on-oci-with-podman-67d49a8b965e | |
registry_space="omv.lan:3000/raro28" | |
declare -A projects=( | |
["front"]="7967" | |
["events"]="67a3" | |
["protected"]="1147" | |
["backend"]="06d8" | |
) | |
architectures=("aarch64" "amd64") | |
build() { | |
local project=$1 | |
local version=${projects[$project]} | |
local oci_image_base="$registry_space/taiga-$project:latest" | |
local podman_manifest_cmd="podman manifest create $oci_image_base" | |
if [ ! -d "taiga-$project" ]; then | |
echo "Cloning taiga-$project repository..." | |
git clone https://github.com/kaleidos-ventures/taiga-$project.git taiga-$project | |
fi | |
pushd "taiga-$project" | |
git reset --hard $version | |
git clean -fdx | |
cp "docker/Dockerfile" "./" | |
for architecture in "${architectures[@]}"; do | |
local oci_image_arch="$oci_image_base-linux-$architecture" | |
echo "Building $oci_image_arch..." | |
podman build --platform linux/$architecture -t "$oci_image_arch" . | |
podman push "$oci_image_arch" | |
podman_manifest_cmd="$podman_manifest_cmd $oci_image_arch" | |
done | |
popd | |
echo "Removing intermediate image: $oci_image_base" | |
podman rmi --force "$oci_image_base" | |
echo "Creating manifest for $oci_image_base" | |
$podman_manifest_cmd | |
echo "Pushing manifest for $oci_image_base" | |
podman manifest push "$oci_image_base" "$oci_image_base" | |
echo "Completed building and pushing $project" | |
} | |
pids=() | |
for project in "${!projects[@]}"; do | |
build "$project" & | |
pids+=($!) | |
done | |
for pid in "${pids[@]}"; do | |
wait "$pid" | |
done | |
echo "All builds and pushes completed" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment