Agenten-Plattform/build-mgmt.sh

47 lines
1.3 KiB
Bash
Executable File

#/bin/bash
# Agenten Plattform
#
# (c) 2024 Magnus Bender
# Institute of Humanities-Centered Artificial Intelligence (CHAI)
# Universitaet Hamburg
# https://www.chai.uni-hamburg.de/~bender
#
# source code released under the terms of GNU Public License Version 3
# https://www.gnu.org/licenses/gpl-3.0.txt
# https://stackoverflow.com/a/4774063
SCRIPTPATH="$(cd -- "$(dirname "$0")" >/dev/null 2>&1; pwd -P)"
source "$SCRIPTPATH/vars.sh"
requirements="requirements-frozen.txt"
if [ "$1" != "-no-updates" ]; then
echo "Update the depencendies in requirements.txt? [may break app] (y/n)"
read newlockfile
if [ "$newlockfile" == "y" ]; then
requirements="requirements.txt"
fi;
fi;
for platform in $PLATFORMS; do
if [ "$platform" != "gpu" ]; then
docker build \
--pull \
--platform "linux/$platform" \
--file "$SCRIPTPATH/utils/mgmt/Dockerfile" \
--build-arg H_UID=1050 \
--build-arg PIP_REQ_FILE="$requirements" \
--build-arg H_GID=1050 \
--tag "$IMAGE_REGISTRY/$IMAGE_OWNER/$IMAGE_NAME_MGMT:$platform" \
"$SCRIPTPATH"
fi;
done;
if [ "$requirements" == "requirements.txt" ]; then
# extract requirements-frozen.txt
cid=$(docker create "$IMAGE_REGISTRY/$IMAGE_OWNER/$IMAGE_NAME_MGMT:arm64")
docker cp "$cid:/ums-agenten/requirements.txt" "$SCRIPTPATH/utils/mgmt/requirements-frozen.txt"
docker rm "$cid"
fi;