-
Notifications
You must be signed in to change notification settings - Fork 15
/
2_prepare_docker_images.sh
executable file
·123 lines (93 loc) · 3.24 KB
/
2_prepare_docker_images.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#!/bin/bash
set -euo pipefail
. utils.sh
: "${SEEDFETCHER_IMAGE:=cyberark/dap-seedfetcher}"
: "${SEEDFETCHER_TAG:=edge}"
main() {
if [[ "${PLATFORM}" = "openshift" ]]; then
set +x
docker login -u _ -p $(oc whoami -t) $DOCKER_REGISTRY_PATH
set -x
fi
if [[ $CONJUR_DEPLOYMENT == oss ]]; then
echo "Prepare Conjur OSS cluster"
prepare_conjur_oss_cluster
else
echo "Prepare DAP cluster"
prepare_conjur_appliance_image
prepare_seed_fetcher_image
fi
if [[ "${DEPLOY_MASTER_CLUSTER}" = "true" ]]; then
prepare_conjur_cli_image
fi
echo "Docker images pushed."
}
prepare_conjur_appliance_image() {
announce "Tagging and pushing Conjur appliance"
conjur_appliance_image=$(platform_image conjur-appliance)
# Try to pull the image if we can
docker pull $CONJUR_APPLIANCE_IMAGE || true
docker tag $CONJUR_APPLIANCE_IMAGE $conjur_appliance_image
if [ ! is_minienv ] || [ "${DEV}" = "false" ] ; then
docker push $conjur_appliance_image
fi
}
prepare_conjur_cli_image() {
announce "Pulling and pushing Conjur CLI image."
docker pull cyberark/conjur-cli:8
docker tag cyberark/conjur-cli:8 conjur-cli:$CONJUR_NAMESPACE_NAME
docker pull alpine:latest
docker tag alpine:latest alpine:$CONJUR_NAMESPACE_NAME
cli_app_image=$(platform_image conjur-cli)
docker tag conjur-cli:$CONJUR_NAMESPACE_NAME $cli_app_image
alpine_image=$(platform_image alpine)
docker tag alpine:$CONJUR_NAMESPACE_NAME $alpine_image
if [ ! is_minienv ] || [ "${DEV}" = "false" ]; then
docker push $cli_app_image
docker push $alpine_image
fi
}
prepare_seed_fetcher_image() {
announce "Pulling and pushing seed-fetcher image."
docker pull "${SEEDFETCHER_IMAGE}:${SEEDFETCHER_TAG}"
seedfetcher_image=$(platform_image seed-fetcher)
docker tag "${SEEDFETCHER_IMAGE}:${SEEDFETCHER_TAG}" ${seedfetcher_image}
if [ ! is_minienv ] || [ "${DEV}" = "false" ]; then
docker push $seedfetcher_image
fi
}
prepare_conjur_oss_cluster() {
announce "Pulling and pushing Conjur OSS image."
# Allow using local conjur images for deployment
conjur_oss_src_image="${LOCAL_CONJUR_IMAGE:-}"
if [[ -z "$conjur_oss_src_image" ]]; then
conjur_oss_src_image="cyberark/conjur:latest"
docker pull $conjur_oss_src_image
fi
conjur_oss_dest_image=$(platform_image "conjur")
echo "Tagging Conjur image $conjur_oss_src_image as $conjur_oss_dest_image"
docker tag "$conjur_oss_src_image" "$conjur_oss_dest_image"
if [ "${DEV}" = "false" ]; then
echo "Pushing Conjur image ${conjur_oss_dest_image} to repo..."
docker push "$conjur_oss_dest_image"
fi
announce "Pulling and pushing postgres image"
postgres_src_image="postgres:15"
docker pull "$postgres_src_image"
if [ "${DEV}" = "false" ]; then
postgres_dest_image=$(platform_image "postgres")
docker tag "$postgres_src_image" "$postgres_dest_image"
docker push "$postgres_dest_image"
fi
announce "Pulling and pushing Nginx image."
nginx_image=$(platform_image "nginx")
# Push nginx image to openshift repo
pushd oss/nginx_base
sed -i -e "s#{{ CONJUR_NAMESPACE_NAME }}#$CONJUR_NAMESPACE_NAME#g" ./proxy/ssl.conf
docker build -t $nginx_image .
if [ "${DEV}" = "false" ]; then
docker push $nginx_image
fi
popd
}
main $@