#!/bin/bash COMMAND_PREFIX="" # We need to run the podman build on the host. If we're in a toolbox or a distrobox we need to # spawn the process on the host. Fortunately both toolbox and distrobox provide ways for us to # do this. We just need to check if "flatpak-spawn" (toolbox) or "distrobox-host-exec" (distrobox) # exist in the PATH of our environment. if command -v "distrobox-host-exec" &> /dev/null; then echo "distrobox detected" # In distrobox you can run "distrobox-host-exec ./path/to/this/script.sh" COMMAND_PREFIX="distrobox-host-exec" elif command -v "flatpak-spawn" &> /dev/null; then echo "toolbox detected" # In toolbox you can run "flatpak-spawn --host ./path/to/this/script.sh" to run this on the host COMMAND_PREFIX="flatpak-spawn --host" else echo "already running as host" fi # Run the build for the CPU image $COMMAND_PREFIX podman build \ --no-cache \ -t gitea.reeseapps.com/services/arch-toolbox:latest \ -f ./infrastructure/graduated/distoolbox/arch-toolbox.containerfile # Run the build for the AMD gpu image $COMMAND_PREFIX podman build \ --no-cache \ -t gitea.reeseapps.com/services/arch-toolbox-amdgpu:latest \ -f ./infrastructure/graduated/distoolbox/arch-amdgpu-toolbox.containerfile