-
Notifications
You must be signed in to change notification settings - Fork 12
/
build_and_push.sh
executable file
·40 lines (31 loc) · 1.63 KB
/
build_and_push.sh
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
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
BUILD_PARAMS="--pull --no-cache"
KRUIZE_UI_DOCKER_REPO="kruize/kruize-ui"
KRUIZE_UI_VERSION="$(grep -m1 '"version"' package.json | tr -d ' ' | cut -d: -f2 | tr -d \" | sed 's/,$//')"
if [ -n "$1" ]; then
KRUIZE_UI_VERSION=$1
fi
KRUIZE_UI_DOCKER_IMAGE=${KRUIZE_UI_DOCKER_REPO}:${KRUIZE_UI_VERSION}
KRUIZE_UI_DOCKERHUB_IMAGE="docker.io/${KRUIZE_UI_DOCKER_REPO}"
KRUIZE_UI_QUAY_IMAGE="quay.io/${KRUIZE_UI_DOCKER_REPO}"
echo
echo "################################################################################"
echo "Build and Push Kruize-UI image: ${KRUIZE_UI_DOCKER_IMAGE} to DockerHub and Quay"
echo "Make sure you have logged in to the docker repos"
echo "################################################################################"
echo
git pull
docker build ${BUILD_PARAMS} --format=docker -t ${KRUIZE_UI_DOCKER_IMAGE} -f Dockerfile .
docker tag ${KRUIZE_UI_DOCKER_IMAGE} ${KRUIZE_UI_DOCKERHUB_IMAGE}:${KRUIZE_UI_VERSION}
docker tag ${KRUIZE_UI_DOCKER_IMAGE} ${KRUIZE_UI_DOCKERHUB_IMAGE}:demo
docker tag ${KRUIZE_UI_DOCKER_IMAGE} ${KRUIZE_UI_DOCKERHUB_IMAGE}:latest
docker tag ${KRUIZE_UI_DOCKER_IMAGE} ${KRUIZE_UI_QUAY_IMAGE}:${KRUIZE_UI_VERSION}
docker tag ${KRUIZE_UI_DOCKER_IMAGE} ${KRUIZE_UI_QUAY_IMAGE}:demo
docker tag ${KRUIZE_UI_DOCKER_IMAGE} ${KRUIZE_UI_QUAY_IMAGE}:latest
docker push ${KRUIZE_UI_DOCKERHUB_IMAGE}:${KRUIZE_UI_VERSION}
docker push ${KRUIZE_UI_DOCKERHUB_IMAGE}:demo
docker push ${KRUIZE_UI_DOCKERHUB_IMAGE}:latest
docker push ${KRUIZE_UI_QUAY_IMAGE}:${KRUIZE_UI_VERSION}
docker push ${KRUIZE_UI_QUAY_IMAGE}:demo
docker push ${KRUIZE_UI_QUAY_IMAGE}:latest
docker images | grep -e "TAG" -e "${KRUIZE_UI_DOCKER_REPO}"