forked from RedHatInsights/rhsm-subscriptions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_deploy.sh
executable file
·34 lines (30 loc) · 1.31 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
29
30
31
32
33
34
#!/bin/bash
# NOTE: if you need to debug this file, use DRY_RUN=true to echo docker commands without running them
set -exv
source cicd_common.sh
IMAGE_TAG=$(git rev-parse --short=7 HEAD)
SMOKE_TEST_TAG="latest"
if [[ -z "$QUAY_USER" || -z "$QUAY_TOKEN" ]]; then
echo "QUAY_USER and QUAY_TOKEN must be set"
exit 1
fi
DOCKER_CONF="$PWD/.docker"
mkdir -p "$DOCKER_CONF"
docker --config="$DOCKER_CONF" login -u="$QUAY_USER" -p="$QUAY_TOKEN" quay.io
for service in $SERVICES; do
IMAGE="quay.io/cloudservices/$service"
DOCKERFILE=$(get_dockerfile $service)
if [[ $(basename $DOCKERFILE) = "Dockerfile.jvm" ]]; then
# quarkus_build
USE_DOCKER=true ./podman_run.sh ./gradlew :$service:quarkusBuild
docker --config="$DOCKER_CONF" build --no-cache -t "${IMAGE}:${IMAGE_TAG}" $service -f $service/$(get_dockerfile $service)
else
# spring boot build
docker --config="$DOCKER_CONF" build --no-cache -t "${IMAGE}:${IMAGE_TAG}" . -f $(get_dockerfile $service)
fi
docker --config="$DOCKER_CONF" push "${IMAGE}:${IMAGE_TAG}"
docker --config="$DOCKER_CONF" tag "${IMAGE}:${IMAGE_TAG}" "${IMAGE}:${SMOKE_TEST_TAG}"
docker --config="$DOCKER_CONF" push "${IMAGE}:${SMOKE_TEST_TAG}"
docker --config="$DOCKER_CONF" tag "${IMAGE}:${IMAGE_TAG}" "${IMAGE}:qa"
docker --config="$DOCKER_CONF" push "${IMAGE}:qa"
done