commit
18a397653a
21 files changed
+2775
No files matched your search
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
scripts_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
repo_dir="$(dirname "$scripts_dir")"
|
||||
image="${LUPHOTO_DEV_IMAGE:-luphoto-dev}"
|
||||
|
||||
case "$(uname -s)" in
|
||||
MINGW*|MSYS*|CYGWIN*)
|
||||
export MSYS_NO_PATHCONV=1
|
||||
scripts_host="$(cygpath -w "$scripts_dir")"
|
||||
repo_host="$(cygpath -w "$repo_dir")"
|
||||
;;
|
||||
*)
|
||||
scripts_host="$scripts_dir"
|
||||
repo_host="$repo_dir"
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ "${LUPHOTO_DEV_REBUILD:-0}" = "1" ] || ! docker image inspect "$image" >/dev/null 2>&1; then
|
||||
docker build -t "$image" -f "$scripts_host/dev.Dockerfile" "$scripts_host"
|
||||
fi
|
||||
|
||||
tty_args=()
|
||||
if [ -t 0 ] && [ -t 1 ]; then
|
||||
tty_args=(-it)
|
||||
fi
|
||||
|
||||
extra_args=()
|
||||
if [ -n "${LUPHOTO_DEV_ARGS:-}" ]; then
|
||||
read -r -a extra_args <<<"$LUPHOTO_DEV_ARGS"
|
||||
fi
|
||||
|
||||
if [ "$#" -eq 0 ]; then
|
||||
set -- bash
|
||||
fi
|
||||
|
||||
exec docker run --rm "${tty_args[@]}" \
|
||||
-v "$repo_host:/src" \
|
||||
-v luphoto-gomod:/root/go/pkg/mod \
|
||||
-v luphoto-gocache:/root/.cache/go-build \
|
||||
-e GOFLAGS="${GOFLAGS:-}" \
|
||||
-w /src \
|
||||
"${extra_args[@]}" \
|
||||
"$image" "$@"
|
||||
Reference in new issue
Block a user