forked from gitlabform/gitlabform
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_docker_images.sh
More file actions
executable file
·37 lines (34 loc) · 990 Bytes
/
build_docker_images.sh
File metadata and controls
executable file
·37 lines (34 loc) · 990 Bytes
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
#!/bin/bash
tags=""
version="$(cat version)"
python_version="3.8"
for os in alpine debian
do
effective_version="${os}_version"
suffix="${!effective_version}"
latest="egnyte/gitlabform:latest-${suffix}"
docker pull "${latest}" || echo "no cache is available"
docker build \
--build-arg PY_VERSION=$python_version \
--build-arg OS_VERSION="${!effective_version}" \
--file "${os}.Dockerfile" \
--tag "${latest}" .
tags="$tags ${latest}"
docker tag "${latest}" "egnyte/gitlabform:${version}-${suffix}"
tags="$tags egnyte/gitlabform:${version}-${suffix}"
if [ "$os" = "alpine" ]
then
docker tag "${latest}" "egnyte/gitlabform:latest"
tags="$tags egnyte/gitlabform:latest"
fi
done
for image in $tags
do
if [ ! -z "${PUSH_IMAGES}" ]
then
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
docker push $image
else
echo "$image"
fi
done