@@ -8,18 +8,17 @@ DRIVER="${DRIVER:-glusterfs-csi-driver}"
88# Set which docker repo to tag
99REPO=" ${REPO:- gluster/ } "
1010
11- # Base image to use for final container images
12- FINAL_BASE=" ${FINAL_BASE:- centos: 7.5.1804} "
13-
1411# Allow overriding default docker command
15- DOCKER_CMD=${DOCKER_CMD:- docker}
12+ RUNTIME_CMD=${RUNTIME_CMD:- docker}
13+
14+ build=" build"
15+ if [[ " ${RUNTIME_CMD} " == " buildah" ]]; then
16+ build=" bud"
17+ fi
1618
1719# Allow disabling tests during build
1820RUN_TESTS=${RUN_TESTS:- 1}
1921
20- # Cleanup build context when done
21- RM_BUILD=${RM_BUILD:- 1}
22-
2322VERSION=" $( git describe --dirty --always --tags | sed ' s/-/./2' | sed ' s/-/./2' ) "
2423BUILDDATE=" $( date -u ' +%Y-%m-%dT%H:%M:%S.%NZ' ) "
2524
@@ -32,27 +31,16 @@ build_args+=( --build-arg "RUN_TESTS=$RUN_TESTS" )
3231build_args+=( --build-arg " GO_DEP_VERSION=$GO_DEP_VERSION " )
3332build_args+=( --build-arg " GO_METALINTER_VERSION=$GO_METALINTER_VERSION " )
3433build_args+=( --build-arg " GO_METALINTER_THREADS=$GO_METALINTER_THREADS " )
35- build_args+=( --build-arg " FINAL_BASE=$FINAL_BASE " )
3634build_args+=( --build-arg " version=$VERSION " )
3735build_args+=( --build-arg " builddate=$BUILDDATE " )
3836
3937# Print Docker version
40- echo " === Docker Version ==="
41- $DOCKER_CMD version
38+ echo " === $RUNTIME_CMD version ==="
39+ $RUNTIME_CMD version
4240
43- # Run container build
44- $DOCKER_CMD build \
45- -t glusterfs-csi-driver-build \
46- --target build \
47- " ${build_args[@]} " \
48- -f pkg/glusterfs/Dockerfile \
49- . \
50- || exit 1
51-
52- # -- Build final container
53- $DOCKER_CMD build \
41+ # -- Build container
42+ $RUNTIME_CMD $build \
5443 -t " ${REPO}${DRIVER} " \
55- --target driver \
5644 " ${build_args[@]} " \
5745 -f pkg/glusterfs/Dockerfile \
5846 . \
@@ -61,10 +49,6 @@ $DOCKER_CMD build \
6149# If running tests, extract profile data
6250if [ " $RUN_TESTS " -ne 0 ]; then
6351 rm -f profile.cov
64- $DOCKER_CMD run glusterfs-csi-driver-build \
65- cat /profile.cov > profile.cov
66- fi
67-
68- if [ " $RM_BUILD " -ne 0 ]; then
69- $DOCKER_CMD rmi -f glusterfs-csi-driver-build
52+ $RUNTIME_CMD run --entrypoint cat " ${REPO}${DRIVER} " \
53+ /profile.cov > profile.cov
7054fi
0 commit comments