#!/bin/bash

. slite/core/podman/init "$@"

echo "Building app: "$MODULE_TAG

if [ -f "$MODULE/Dockerfile.build_pre.sh" ]; then
	echo "Prebuild file detected. Executing it."
	$MODULE/Dockerfile.build_pre.sh
fi

sudo podman build --network=host -t $MODULE_TAG:latest -f $MODULE/Dockerfile .
if [ "$?" = "0" ]; then
	echo "Image Building Completed!"
	echo "-------------------------"
else
	exit 1
fi


if [ -f "$MODULE/Dockerfile.build_post.sh" ]; then
	echo "Postbuild file detected. Executing it."
	$MODULE/Dockerfile.build_post.sh
fi

# sudo podman image ls
date

echo "------------------------"
echo "Docker build successfull"
echo "------------------------"