51 lines
1.4 KiB
Bash
Executable File
51 lines
1.4 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
|
|
platform="amd64"
|
|
tag="gpu-amd64"
|
|
else
|
|
tag="cpu-$platform"
|
|
fi;
|
|
|
|
docker build \
|
|
--pull \
|
|
--platform "linux/$platform" \
|
|
--file "$SCRIPTPATH/utils/agent/Dockerfile" \
|
|
--build-arg FROM_IMAGE="$IMAGE_REGISTRY/$IMAGE_OWNER/$IMAGE_AGENT_BASE:$tag" \
|
|
--build-arg PIP_REQ_FILE="$requirements" \
|
|
--tag "$IMAGE_REGISTRY/$IMAGE_OWNER/$IMAGE_NAME_AGENT:$tag" \
|
|
"$SCRIPTPATH"
|
|
done;
|
|
|
|
if [ "$requirements" == "requirements.txt" ]; then
|
|
# extract requirements-frozen.txt
|
|
cid=$(docker create "$IMAGE_REGISTRY/$IMAGE_OWNER/$IMAGE_NAME_AGENT:cpu-arm64")
|
|
docker cp "$cid:/ums-agenten/requirements-frozen.txt" "$SCRIPTPATH/utils/agent/requirements-frozen.txt"
|
|
docker rm "$cid"
|
|
fi;
|