2021-12-21 20:40:27 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
# move into base directory, in case this script is not executed via `make container`
|
|
|
|
cd "$(dirname "$0")/.."
|
|
|
|
|
|
|
|
# normalize branch name to reflect a valid image name
|
2022-01-01 18:20:41 +00:00
|
|
|
BRANCH=$(git branch --show-current 2>/dev/null | sed 's/[^a-z0-9-]/_/ig')
|
|
|
|
TAG="gluon:${BRANCH:-latest}"
|
2021-12-21 20:40:27 +00:00
|
|
|
|
|
|
|
if [ "$(command -v podman)" ]
|
|
|
|
then
|
|
|
|
podman build -t "${TAG}" contrib/docker
|
|
|
|
podman run -it --rm --userns=keep-id --volume="$(pwd):/gluon" "${TAG}"
|
|
|
|
elif [ "$(command -v docker)" ]
|
|
|
|
then
|
|
|
|
docker build -t "${TAG}" contrib/docker
|
2023-04-20 07:28:49 +00:00
|
|
|
docker run -it --rm --user "$(id -u):$(id -g)" --volume="$(pwd):/gluon" "${TAG}"
|
2021-12-21 20:40:27 +00:00
|
|
|
else
|
|
|
|
1>&2 echo "Please install either podman or docker. Exiting" >/dev/null
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|