-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest
More file actions
executable file
·35 lines (21 loc) · 751 Bytes
/
test
File metadata and controls
executable file
·35 lines (21 loc) · 751 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
#!/usr/bin/env bash
set -Eeuo pipefail
PROGNAME=$(basename $0)
pushd $(cd -P -- "$(dirname -- "$0")" && pwd -P)/..
function clean_before_exit {
popd
}
function error_and_exit {
echo "${PROGNAME}: ${1:-"Unknown error"}" 1>&2
exit 1
}
trap 'error_and_exit "${LINENO}: Unknown error"' ERR
trap clean_before_exit EXIT
[ -z ${DOCKER_REPO-} ] && exit 1
[ -z ${NAME-} ] && exit 1
VERSION=$(if [ -z ${VERSION-} ]; then echo $(if [ -z ${DOCKER_TAG-} ]; then echo latest; else echo $DOCKER_TAG; fi); else echo $VERSION; fi)
IMAGE_NAME=$(if [ -z ${IMAGE_NAME-} ]; then echo $DOCKER_REPO/$NAME:$VERSION; else echo $IMAGE_NAME; fi)
CID=$(docker run --entrypoint "./test.sh" -d $IMAGE_NAME)
docker logs -f $CID
RET=$(docker wait $CID)
exit $RET