Skip to content

Commit 09411ca

Browse files
authored
env vars for dev building images (#796)
1 parent 44c9db2 commit 09411ca

File tree

2 files changed

+28
-18
lines changed

2 files changed

+28
-18
lines changed

.dockerignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/.github/
2+
/adopters/
3+
/deploy/
4+
/docs/
5+
/e2e-tests/

e2e-tests/build

+23-18
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,31 @@ test_dir="$(dirname $0)"
88
src_dir="$(realpath ${test_dir}/..)"
99
IMAGE=$(echo "$IMAGE" | sed -e 's#percona/#perconalab/#')
1010

11+
if [[ ${DOCKER_NOCACHE:-1} == 1 ]]; then
12+
no_cache="--no-cache"
13+
fi
14+
if [[ ${DOCKER_SQUASH:-1} == 1 ]]; then
15+
squash="--squash"
16+
fi
17+
1118
build_operator() {
12-
if [ "${RELEASE:-1}" = 0 ]; then
13-
GO_LDFLAGS="-race"
14-
fi
19+
if [ "${RELEASE:-1}" = 0 ]; then
20+
GO_LDFLAGS="-race"
21+
fi
1522

16-
export IMAGE
17-
export GO_LDFLAGS="-w -s -trimpath $GO_LDFLAGS"
18-
pushd ${src_dir}
19-
docker build \
20-
--build-arg GIT_COMMIT=$GIT_COMMIT \
21-
--build-arg GIT_BRANCH=$GIT_BRANCH \
22-
--build-arg GO_LDFLAGS="$GO_LDFLAGS" \
23-
--squash \
24-
--no-cache \
25-
-t "${IMAGE}" -f build/Dockerfile .
26-
popd
27-
docker push ${IMAGE}
23+
export IMAGE
24+
export GO_LDFLAGS="-w -s -trimpath $GO_LDFLAGS"
25+
pushd ${src_dir}
26+
docker build \
27+
--build-arg GIT_COMMIT=$GIT_COMMIT \
28+
--build-arg GIT_BRANCH=$GIT_BRANCH \
29+
--build-arg GO_LDFLAGS="$GO_LDFLAGS" \
30+
$squash \
31+
$no_cache \
32+
-t "${IMAGE}" -f build/Dockerfile .
33+
popd
34+
docker push ${IMAGE}
2835
}
2936

30-
until docker ps;
31-
do sleep 1;
32-
done
37+
until docker ps; do sleep 1; done
3338
build_operator

0 commit comments

Comments
 (0)