summaryrefslogtreecommitdiffstats
path: root/deliveries/os_docker_base.sh
blob: b2a32a78040ee841fec72420b1e85090d3510396 (plain)
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
#!/bin/bash
# Builds and pushes versions of Portal images
# Invoked by scripts that set VERSION and LATEST

# be verbose
set -x 

if [ -z "$VERSION" ]; then
    echo "VERSION not set"
    exit 1
fi
if [ -z "$LATEST" ]; then
    echo "LATEST not set"
    exit 1
fi

# ONAP docker registry for pushing; has been moved to 
# .env (or other .env override file from command line)
# NEXUS_REPO=nexus3.onap.org:10003

# Establish environment variables
source $(dirname $0)/.env
if [ $1 ]; then
  source $(dirname $0)/$1
fi

# Build the containers
if [ "$SKIP_BUILD_BEFORE_PUSH" = "please" ]; then
    echo "SKIPPING DOCKER IMAGE BUILD!"
else 
    ./build_portalapps_dockers.sh $1
fi

if [ "${PORTAL_DOCKERFILE}" != "skip" ] && [ "${EP_IMG_NAME}" != "skip" ]; then
  APP_VERSION="${NEXUS_REPO}/${EP_IMG_NAME}:${VERSION}"
  APP_LATEST="${NEXUS_REPO}/${EP_IMG_NAME}:${LATEST}"

  docker tag ${EP_IMG_NAME}:${PORTAL_TAG} ${APP_VERSION}
  docker tag ${EP_IMG_NAME}:${PORTAL_TAG} ${APP_LATEST}

  docker push ${APP_VERSION}
  docker push ${APP_LATEST}
fi 

if [ "${SDK_DOCKERFILE}" != "skip" ] && [ "${SDK_IMG_NAME}" != "skip" ]; then
  SDK_VERSION="${NEXUS_REPO}/${SDK_IMG_NAME}:${VERSION}"
  SDK_LATEST="${NEXUS_REPO}/${SDK_IMG_NAME}:${LATEST}"

  docker tag ${SDK_IMG_NAME}:${PORTAL_TAG} ${SDK_VERSION}
  docker tag ${SDK_IMG_NAME}:${PORTAL_TAG} ${SDK_LATEST}

  docker push ${SDK_VERSION}
  docker push ${SDK_LATEST}
fi

if [ "${FE_DOCKERFILE}" != "skip" ] && [ "${FE_IMG_NAME}" != "skip" ]; then
  FE_VERSION="${NEXUS_REPO}/${FE_IMG_NAME}:${VERSION}"
  FE_LATEST="${NEXUS_REPO}/${FE_IMG_NAME}:${LATEST}"

  docker tag ${FE_IMG_NAME}:${PORTAL_TAG} ${FE_VERSION}
  docker tag ${FE_IMG_NAME}:${PORTAL_TAG} ${FE_LATEST}

  docker push ${FE_VERSION}
  docker push ${FE_LATEST}
fi 

if [ "${BE_DOCKERFILE}" != "skip" ] && [ "${BE_IMG_NAME}" != "skip" ]; then
  BE_VERSION="${NEXUS_REPO}/${BE_IMG_NAME}:${VERSION}"
  BE_LATEST="${NEXUS_REPO}/${BE_IMG_NAME}:${LATEST}"

  docker tag ${BE_IMG_NAME}:${PORTAL_TAG} ${BE_VERSION}
  docker tag ${BE_IMG_NAME}:${PORTAL_TAG} ${BE_LATEST}

  docker push ${BE_VERSION}
  docker push ${BE_LATEST}
fi 

if [ "${DB_DOCKERFILE}" != "skip" ] && [ "${DB_IMG_NAME}" != "skip" ]; then
  DB_VERSION="${NEXUS_REPO}/${DB_IMG_NAME}:${VERSION}"
  DB_LATEST="${NEXUS_REPO}/${DB_IMG_NAME}:${LATEST}"

  docker tag ${DB_IMG_NAME}:${PORTAL_TAG} ${DB_VERSION}
  docker tag ${DB_IMG_NAME}:${PORTAL_TAG} ${DB_LATEST}

  docker push ${DB_VERSION}
  docker push ${DB_LATEST}
fi

if [ "${WMS_DOCKERFILE}" != "skip" ] && [ "${WMS_IMG_NAME}" != "skip" ]; then
  WMS_VERSION="${NEXUS_REPO}/${WMS_IMG_NAME}:${VERSION}"
  WMS_LATEST="${NEXUS_REPO}/${WMS_IMG_NAME}:${LATEST}"

  docker tag ${WMS_IMG_NAME}:${PORTAL_TAG} ${WMS_VERSION}
  docker tag ${WMS_IMG_NAME}:${PORTAL_TAG} ${WMS_LATEST}

  docker push ${WMS_VERSION}
  docker push ${WMS_LATEST}
fi