#!/usr/bin/env bash
# shellcheck shell=bash
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
##@Version           :  202303142021-git
# @@Author           :  Jason Hempstead
# @@Contact          :  jason@casjaysdev.pro
# @@License          :  LICENSE.md
# @@ReadME           :  build-project --help
# @@Copyright        :  Copyright: (c) 2023 Jason Hempstead, Casjays Developments
# @@Created          :  Tuesday, Mar 14, 2023 20:21 EDT
# @@File             :  build-project
# @@Description      :  
# @@Changelog        :  New script
# @@TODO             :  Better documentation
# @@Other            :  
# @@Resource         :  
# @@Terminal App     :  no
# @@sudo/root        :  no
# @@Template         :  shell/sh
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
HOME="${USER_HOME:-$HOME}"
USER="${SUDO_USER:-$USER}"
RUN_USER="${SUDO_USER:-$USER}"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Set sh options

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Define variables

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Export variables
WORKDIR="${WORKDIR:-/data/build}"
PLATFORMS="${PLATFORMS:---platform=linux/amd64,linux/arm64}"
BUILDAH_ISOLATION="$BUILDAH_ISOLATION:-chroot}"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Main application
if [ -f /data/build/*/Dockerfile* ]; then 
buildah build $PLATFORMS /data/build/*/Dockerfile*
elif [ -f /data/build/Dockerfile* ]; then 
buildah build $PLATFORMS /data/build/Dockerfile*
else
echo "Can not find any dockerfiles in /data/build or /data/build/*"
exit 1
fi
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# End application
# ex: ts=2 sw=2 et filetype=sh
