-
Notifications
You must be signed in to change notification settings - Fork 45
/
build-scale.sh
executable file
·48 lines (38 loc) · 1.55 KB
/
build-scale.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
#!/usr/bin/env sh
set -e
# When CI_BUILD_TAG is unset we are building a snapshot
if [[ "${CI_BUILD_TAG}x" == "x" ]]
then
docker login -u ${DOCKER_DEV_USER} -p "${DOCKER_DEV_PASS}" ${REGISTRY}
export IMAGE_URL=${REGISTRY}/${DOCKER_DEV_ORG}/${IMAGE_PREFIX}
# Grab latest for caching purposes
docker pull ${IMAGE_URL} || true
docker build \
--cache-from ${IMAGE_URL} \
--label VERSION=${CI_BUILD_REF:0:8} \
--build-arg EPEL_INSTALL=${EPEL_INSTALL} \
--build-arg IMAGE=${CENTOS_IMAGE} \
--build-arg BUILDNUM=${CI_BUILD_REF:0:8} \
--build-arg GOSU_URL=${GOSU_URL} \
-t ${IMAGE_URL}:${CI_BUILD_REF:0:8} \
-t ${IMAGE_URL} .
export SCALE_VERSION=$(docker run --entrypoint /bin/bash ${IMAGE_URL} -c 'python -c "import scale; print(scale.__docker_version__)"')
docker tag ${IMAGE_URL} ${IMAGE_URL}:${SCALE_VERSION}
docker push ${IMAGE_URL}
docker push ${IMAGE_URL}:${SCALE_VERSION}
docker push ${IMAGE_URL}:${CI_BUILD_REF:0:8}
else
docker login -u ${DOCKER_USER} -p "${DOCKER_PASS}" ${REGISTRY}
export IMAGE_URL=${REGISTRY}/${DOCKER_ORG}/${IMAGE_PREFIX}
# Grab latest for caching purposes
docker pull ${IMAGE_URL} || true
docker build \
--label VERSION=${CI_BUILD_TAG} \
--build-arg EPEL_INSTALL=${EPEL_INSTALL} \
--build-arg IMAGE=${CENTOS_IMAGE} \
--build-arg GOSU_URL=${GOSU_URL} \
-t ${IMAGE_URL} \
-t ${IMAGE_URL}:${CI_BUILD_TAG} .
docker push ${IMAGE_URL}
docker push ${IMAGE_URL}:${CI_BUILD_TAG}
fi