forked from firstBitMarksistskaya/onec-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-edt-swarm-agent.sh
executable file
·45 lines (37 loc) · 1.11 KB
/
build-edt-swarm-agent.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
#!/bin/bash
set -e
if [ $DOCKER_CR_YANDEX = 'true' ] ; then
cat $DOCKER_PASSWORD | docker login \
--username $DOCKER_LOGIN \
--password-stdin \
$DOCKER_REGISTRY_URL
else
docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD $DOCKER_REGISTRY_URL
fi
if [ $DOCKER_SYSTEM_PRUNE = 'true' ] ; then
docker system prune -af
fi
last_arg='.'
if [ $NO_CACHE = 'true' ] ; then
last_arg='--no-cache .'
fi
edt_version=$EDT_VERSION
edt_escaped="${edt_version// /_}"
docker build \
--pull \
--build-arg ONEC_USERNAME=$ONEC_USERNAME \
--build-arg ONEC_PASSWORD=$ONEC_PASSWORD \
--build-arg EDT_VERSION="$EDT_VERSION" \
--build-arg EDT_FOLDER="$EDT_FOLDER" \
-t $DOCKER_REGISTRY_URL/edt:$edt_escaped \
-f edt/Dockerfile \
$last_arg
docker push $DOCKER_REGISTRY_URL/edt:$edt_escaped
docker build \
--build-arg DOCKER_REGISTRY_URL=$DOCKER_REGISTRY_URL \
--build-arg BASE_IMAGE=edt \
--build-arg BASE_TAG=$edt_escaped \
-t $DOCKER_REGISTRY_URL/edt-agent:$edt_escaped \
-f swarm-jenkins-agent/Dockerfile \
$last_arg
docker push $DOCKER_REGISTRY_URL/edt-agent:$edt_escaped