-
-
Notifications
You must be signed in to change notification settings - Fork 331
Expand file tree
/
Copy pathcreate.sh
More file actions
33 lines (26 loc) · 682 Bytes
/
create.sh
File metadata and controls
33 lines (26 loc) · 682 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
#!/usr/bin/env bash
set -euxo pipefail
if [ -z "${GITHUB_REPOSITORY_ID:-}" ]; then
echo "GITHUB_REPOSITORY_ID is unset!"
exit 1
fi
if [ -z "${GITHUB_WORKSPACE:-}" ]; then
echo "GITHUB_WORKSPACE is unset!"
exit 1
fi
IMAGE="${1:-}"
if [ -z "${IMAGE}" ]; then
echo "Container image is unset!"
exit 1
fi
if command -v docker &> /dev/null; then
DOCKER="docker"
elif command -v podman &> /dev/null; then
DOCKER="podman"
else
echo "Could not find docker / podman!"
exit 1
fi
exec "${DOCKER}" run -d --name "${GITHUB_REPOSITORY_ID}" \
-v "${GITHUB_WORKSPACE}:/working" --workdir "/working" \
--entrypoint "tail" "${IMAGE}" -f /dev/null