fix: update run.sh to use current directory for AZURITE_DIR and correct env-file paths

This commit is contained in:
2026-02-28 19:45:10 +01:00
parent b698521720
commit ffdfc2697b

15
run.sh
View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
AZURITE_DIR="${AZURITE_DIR:-./storage}" AZURITE_DIR="${AZURITE_DIR:-$(pwd)}"
CONTAINER_ARGS=() CONTAINER_ARGS=()
while [[ $# -gt 0 ]]; do while [[ $# -gt 0 ]]; do
@@ -10,6 +10,15 @@ while [[ $# -gt 0 ]]; do
CONTAINER_ARGS+=("--oauth") CONTAINER_ARGS+=("--oauth")
shift 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 echo "Unknown argument: $1" >&2
exit 1 exit 1
@@ -18,9 +27,9 @@ while [[ $# -gt 0 ]]; do
done done
if command -v dockerd &> /dev/null; then if command -v dockerd &> /dev/null; then
docker run --rm -d --name azurite --env-file accounts.env -p 443:443 -v "$AZURITE_DIR":/storage azurite:latest "${CONTAINER_ARGS[@]}" docker run --rm -d --name azurite --env-file "$AZURITE_DIR/accounts.env" -p 443:443 -v "$AZURITE_DIR/storage":/storage azurite:latest "${CONTAINER_ARGS[@]}"
elif command -v container &> /dev/null; then elif command -v container &> /dev/null; then
container run --rm -d --name azurite --env-file accounts.env -p 443:443 --mount type=bind,source="$AZURITE_DIR",target=/storage azurite:latest "${CONTAINER_ARGS[@]}" container run --rm -d --name azurite --env-file "$AZURITE_DIR/accounts.env" -p 443:443 --mount type=bind,source="$AZURITE_DIR/storage",target=/storage azurite:latest "${CONTAINER_ARGS[@]}"
else else
echo "Neither supported container runtime found." >&2 echo "Neither supported container runtime found." >&2
exit 1 exit 1