forked from RedHatInsights/insights-runtimes-inventory
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_deploy.sh
executable file
·28 lines (22 loc) · 1.11 KB
/
build_deploy.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
#!/bin/bash
set -exv
REST_IMAGE_NAME="quay.io/cloudservices/insights-rbi-rest"
EVENTS_IMAGE_NAME="quay.io/cloudservices/insights-rbi-events"
IMAGE_TAG=$(git rev-parse --short=7 HEAD)
if [[ -z "$QUAY_USER" || -z "$QUAY_TOKEN" ]]; then
echo "QUAY_USER and QUAY_TOKEN must be set"
exit 1
fi
# if this is a PR, use a different tag, since PR tags expire
if [ ! -z "$ghprbPullId" ]; then
IMAGE_TAG="pr-${ghprbPullId}-${IMAGE_TAG}"
fi
DOCKER_CONF="$PWD/.docker"
mkdir -p "$DOCKER_CONF"
docker --config="$DOCKER_CONF" login -u="$QUAY_USER" -p="$QUAY_TOKEN" quay.io
docker --config="$DOCKER_CONF" build -t "${REST_IMAGE_NAME}:${IMAGE_TAG}" -t "${REST_IMAGE_NAME}:latest" -f deploy/docker/rest/Dockerfile .
docker --config="$DOCKER_CONF" build -t "${EVENTS_IMAGE_NAME}:${IMAGE_TAG}" -t "${EVENTS_IMAGE_NAME}:latest" -f deploy/docker/events/Dockerfile .
docker --config="$DOCKER_CONF" push "${REST_IMAGE_NAME}:${IMAGE_TAG}"
docker --config="$DOCKER_CONF" push "${REST_IMAGE_NAME}:latest"
docker --config="$DOCKER_CONF" push "${EVENTS_IMAGE_NAME}:${IMAGE_TAG}"
docker --config="$DOCKER_CONF" push "${EVENTS_IMAGE_NAME}:latest"