38 lines
1.2 KiB
Bash
Executable File
38 lines
1.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
AZURITE_DIR="${AZURITE_DIR:-$(pwd)}"
|
|
CONTAINER_ARGS=()
|
|
AZURITE_IMAGE="${AZURITE_IMAGE:-azurite:latest}"
|
|
|
|
while [[ $# -gt 0 ]]; do
|
|
case "$1" in
|
|
-o|--oauth)
|
|
# OAuth support
|
|
CONTAINER_ARGS+=("--oauth")
|
|
shift
|
|
;;
|
|
-d|--azurite-dir)
|
|
if [[ -n "$2" && -d "$2" ]]; then
|
|
AZURITE_DIR="$2"
|
|
shift 2
|
|
else
|
|
echo "Error: Selected directory does not exist." >&2
|
|
exit 1
|
|
fi
|
|
;;
|
|
*)
|
|
echo "Unknown argument: $1" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
done
|
|
|
|
if command -v dockerd &> /dev/null; then
|
|
docker run --rm -d --name azurite --env-file "$AZURITE_DIR/accounts.env" -p 443:443 -v "$AZURITE_DIR/storage":/storage "$AZURITE_IMAGE" "${CONTAINER_ARGS[@]}"
|
|
elif command -v container &> /dev/null; then
|
|
container run -c 2 -m 512M --rm -d --name azurite --env-file "$AZURITE_DIR/accounts.env" -p 443:443 --mount type=bind,source="$AZURITE_DIR/storage",target=/storage "$AZURITE_IMAGE" "${CONTAINER_ARGS[@]}"
|
|
else
|
|
echo "Neither supported container runtime found." >&2
|
|
exit 1
|
|
fi
|