-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·48 lines (40 loc) · 1.22 KB
/
build.sh
File metadata and controls
executable file
·48 lines (40 loc) · 1.22 KB
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
#!/usr/bin/env sh
. env.sh
log="$(mktemp image.log.XXXX)"
trap "rm -f $log" EXIT
if ! >"$log" 2>&1 docker pull "$SOURCE_IMAGE"; then
>&2 echo 'Unable to find '"$SOURCE_IMAGE"'!'
>&2 cat "$log"
exit 4;
fi
BASE_IMAGE_DIGEST=$(digest_of "$SOURCE_IMAGE" "$log")
if [ "x$BASE_IMAGE_DIGEST" = 'x' ]; then
exit 88
fi
>&2 echo "BASE_IMAGE_DIGEST=${BASE_IMAGE_DIGEST}"
if ! >"$log" 2>&1 docker build \
--build-arg "ALPINE_VERSION=${ALPINE_VERSION}" \
--build-arg "BASE_IMAGE_DIGEST=${BASE_IMAGE_DIGEST}" \
--build-arg "PYTHON_VERSION=${PYTHON_VERSION}" \
--build-arg "BUILD_ROOT=/d" \
-f buildroot/Dockerfile.alpine \
-t "${IMAGE_TAG}-buildroot" \
. ; then
>&2 echo 'Unable to build '"${IMAGE_TAG}-buildroot"'!'
>&2 cat "$log"
exit 8;
fi
if ! >"$log" 2>&1 docker build \
--build-arg "ALPINE_VERSION=${ALPINE_VERSION}" \
--build-arg "BASE_IMAGE_DIGEST=${BASE_IMAGE_DIGEST}" \
--build-arg "PYTHON_VERSION=${PYTHON_VERSION}" \
--build-arg "BUILD_ROOT=/d" \
--build-arg "SOURCE_IMAGE=${IMAGE_TAG}-buildroot" \
-f buildroot/Dockerfile.alpine \
-t "${IMAGE_TAG}" \
. ; then
>&2 echo 'Unable to build '"$IMAGE_TAG"'!'
>&2 cat "$log"
exit 8;
fi
echo "$IMAGE_TAG"