backend redesign
This commit is contained in:
19
bin/deploy
19
bin/deploy
@@ -1,11 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
#REMOTE=northamerica-northeast2-docker.pkg.dev/dexorder-430504/dexorder
|
||||
REMOTE=git.dxod.org/dexorder/dexorder
|
||||
REMOTE=${REMOTE:-git.dxod.org/dexorder/dexorder}
|
||||
|
||||
if [ "$1" != "backend" ] && [ "$1" != "web" ]; then
|
||||
if [ "$1" != "flink" ] && [ "$1" != "relay" ] && [ "$1" != "ingestor" ] && [ "$1" != "web" ]; then
|
||||
echo
|
||||
echo usage: "$0 "'{backend|web} [''dev''] [config] [deployment] [kubernetes] [image_tag]'
|
||||
echo usage: "$0 "'{flink|relay|ingestor|web} [''dev''] [config] [deployment] [kubernetes] [image_tag]'
|
||||
echo
|
||||
echo ' [''dev''] if the literal string ''dev'' is not the second argument, then the build refuses to run if source code is not checked in. Otherwise, the git revision numbers are used in the image tag.'
|
||||
echo
|
||||
@@ -86,14 +86,21 @@ fi
|
||||
|
||||
if [ "$DEPLOY" == "0" ]; then
|
||||
ACTION=Building
|
||||
NO_CACHE=--no-cache
|
||||
#NO_CACHE=--no-cache
|
||||
else
|
||||
ACTION=Making
|
||||
fi
|
||||
|
||||
|
||||
echo $ACTION $PROJECT config=$CONFIG deployment=$DEPLOYMENT '=>' $TAG
|
||||
docker build $NO_CACHE -f deploy/Dockerfile-$PROJECT --build-arg="CONFIG=$CONFIG" --build-arg="DEPLOYMENT=$DEPLOYMENT" -t dexorder/ai-$PROJECT:latest . || exit 1
|
||||
|
||||
# Copy protobuf definitions into project directory for Docker build
|
||||
# Using rsync --checksum so unchanged files keep their timestamps (preserves docker layer cache)
|
||||
rsync -a --checksum --delete protobuf/ $PROJECT/protobuf/
|
||||
|
||||
docker build $NO_CACHE -f $PROJECT/Dockerfile --build-arg="CONFIG=$CONFIG" --build-arg="DEPLOYMENT=$DEPLOYMENT" -t dexorder/ai-$PROJECT:latest $PROJECT || exit 1
|
||||
|
||||
# Cleanup is handled by trap
|
||||
docker tag dexorder/ai-$PROJECT:latest dexorder/ai-$PROJECT:$TAG
|
||||
docker tag dexorder/ai-$PROJECT:$TAG $REMOTE/ai-$PROJECT:$TAG
|
||||
docker tag $REMOTE/ai-$PROJECT:$TAG $REMOTE/ai-$PROJECT:latest
|
||||
@@ -105,7 +112,7 @@ echo "$(date)" built $REMOTE/ai-$PROJECT:$TAG
|
||||
|
||||
if [ "$DEPLOY" == "1" ]; then
|
||||
docker push $REMOTE/ai-$PROJECT:$TAG
|
||||
YAML=$(sed "s#image: dexorder/ai-$PROJECT*#image: $REMOTE/ai-$PROJECT:$TAG#" deploy/$KUBERNETES.yaml)
|
||||
YAML=$(sed "s#image: dexorder/ai-$PROJECT*#image: $REMOTE/ai-$PROJECT:$TAG#" deploy/k8s/$KUBERNETES.yaml)
|
||||
echo "$YAML" | kubectl apply -f - || echo "$YAML" "\nkubectl apply failed" && exit 1
|
||||
echo deployed $KUBERNETES.yaml $REMOTE/ai-$PROJECT:$TAG
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user