fix: streamline port exposure handling in run script
This commit is contained in:
18
run.sh
18
run.sh
@@ -1,8 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
EXPOSED_PORTS=("-p" "443:443")
|
||||
OAUTH_ENABLED=""
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--oauth)
|
||||
OAUTH_ENABLED=true
|
||||
EXPOSED_PORTS=("-p" "443:10000" "-p" "10001:10001" "-p" "10002:10002")
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if command -v dockerd &> /dev/null; then
|
||||
docker run --rm -it --name azurite --env-file accounts.env -p 443:443 -v ./storage:/storage azurite:latest "$@"
|
||||
docker run --rm -it --name azurite --env-file accounts.env "${EXPOSED_PORTS[@]}" -v ./storage:/storage azurite:latest "$@"
|
||||
elif command -v container &> /dev/null; then
|
||||
container run --rm -it --name azurite --env-file accounts.env -p 443:443 --mount type=bind,source=./storage,target=/storage azurite:latest "$@"
|
||||
container run --rm -it --name azurite --env-file accounts.env "${EXPOSED_PORTS[@]}" --mount type=bind,source=./storage,target=/storage azurite:latest "$@"
|
||||
else
|
||||
echo "Neither supported container runtime found." >&2
|
||||
exit 1
|
||||
|
||||
Reference in New Issue
Block a user