-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild-docker.sh
executable file
·48 lines (39 loc) · 1.02 KB
/
build-docker.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
#!/bin/sh -ex
echo
echo "# CREATE BUILD ENVIRONMENT"
echo
if [ -z "$VERSION" ];
then
echo "# RESOLVE VERSION"
if BRANCH_CURRENT=$(git branch --show-current) \
&& [ "$BRANCH_CURRENT" != "master" ];
then
VERSION="$BRANCH_CURRENT"
else
VERSION="latest"
fi
fi
if [ ! -z "$DOCKER_REMOTE_REGISTRY" ];
then
echo "# PULL DOCKER IMAGE"
remoteImage="$DOCKER_REMOTE_REGISTRY/$(uname -m)/archlinux-basedevel:$VERSION"
localImage="$(uname -m)/archlinux-basedevel:$VERSION"
if docker pull $remoteImage;
then
docker tag $remoteImage $localImage
fi
fi
if [ -z "$(docker image ls -q $(uname -m)/archlinux-basedevel:$VERSION)" ];
then
echo "# BUILD DOCKER IMAGE"
if [ -z "$(docker image ls -q $(uname -m)/archlinux:$VERSION)" ];
then
cd docker/archlinux-docker
make docker-image VERSION="$VERSION"
cd ../..
fi
cd docker/archlinux-basedevel-docker
make docker-image VERSION="$VERSION"
cd ../..
fi
VERSION=$VERSION docker/archlinux-basedevel-docker/run.sh ./build.sh $@