forked from just-ai/mlp-python-service-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·28 lines (19 loc) · 768 Bytes
/
build.sh
File metadata and controls
executable file
·28 lines (19 loc) · 768 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash
ROOT=$(dirname $0)
cd "$ROOT"
SERVICE_NAME=mlp-hello-world-service
BUILD_BRANCH=$(git rev-parse --abbrev-ref HEAD)
BRANCH_NAME_LOWER=`echo $BUILD_BRANCH | tr '[:upper:]' '[:lower:]'`
SECRET_FILE=~/.mlp-secret-$SERVICE_NAME
if [[ ! -e $SECRET_FILE ]]; then
echo $(tr -dc a-z0-9 </dev/urandom | head -c 24) > $SECRET_FILE
fi
SECRET=$(cat $SECRET_FILE)
IMAGE=docker-pub.caila.io/caila-public/$SERVICE_NAME-$SECRET:$BRANCH_NAME_LOWER
DOCKER_BUILDKIT=1 docker build . -t "$IMAGE"
echo "$IMAGE"
docker login docker-pub.caila.io -u 'robot$caila-public' -p 'gaerrvb54zjvRx8klacJjh905QZ4Gw7L'
docker push "$IMAGE"
echo --------------------------------------------------
echo Docker image: $IMAGE
echo --------------------------------------------------