Agent should work
This commit is contained in:
50
build-agent.sh
Executable file
50
build-agent.sh
Executable file
@ -0,0 +1,50 @@
|
||||
#/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/docker-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/docker-agent/requirements-frozen.txt"
|
||||
docker rm "$cid"
|
||||
fi;
|
Reference in New Issue
Block a user