-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker
executable file
·28 lines (25 loc) · 990 Bytes
/
docker
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
#!/bin/bash
set -o errexit -o pipefail -o noclobber -o nounset
# Cannot use $HOME or ~ because HOME is overwritten by the GitHub runner for some commands
DOCKER_EXE="$(getent passwd "${USER:-$LOGNAME}" | cut -d : -f 6)/bin/docker"
if [ -v "CELERITY_DOCKER_SHIM_CHECK" ] && [ "$CELERITY_DOCKER_SHIM_CHECK" -eq 1 ]; then
if [ ! -x "$DOCKER_EXE" ]; then
echo "Invalid Docker executable: '$DOCKER_EXE'" 1>&2
exit 1
fi
if [ ! -v "CELERITY_CI_DOCKER_CREATE_OPTIONS" ]; then
echo "CELERITY_CI_DOCKER_CREATE_OPTIONS is not set" 1>&2
exit 1
fi
echo "Docker shimmed" 1>&2
exit 0
fi
# We shim "docker create" because we need per-runner (or rather, runner
# host platform) options. Unfortunately GitHub workflows don't offer
# any way of setting these options dynamically using expressions.
if [ $# -gt 1 ] && [ "$1" == "create" ]; then
shift
"$DOCKER_EXE" create $CELERITY_CI_DOCKER_CREATE_OPTIONS "$@"
else
"$DOCKER_EXE" "$@"
fi