diff --git a/docker/Dockerfile.go_build b/docker/Dockerfile.go_build index a80a3cdef..051831dd7 100644 --- a/docker/Dockerfile.go_build +++ b/docker/Dockerfile.go_build @@ -89,3 +89,8 @@ WORKDIR /data # Entrypoint will handle permission fixes and user switching ENTRYPOINT ["/entrypoint.sh"] +# Default to a complete single-process cluster (master+volume+filer+S3+admin) +# so the image is usable out of the box — including in environments like +# GitHub Actions service containers that cannot pass arguments to the entrypoint. +# Override with any other subcommand at `docker run` / compose time. +CMD ["mini", "-dir=/data"] diff --git a/docker/Dockerfile.local b/docker/Dockerfile.local index c37e5f78a..a275cc639 100644 --- a/docker/Dockerfile.local +++ b/docker/Dockerfile.local @@ -40,3 +40,8 @@ WORKDIR /data # Entrypoint will handle permission fixes and user switching ENTRYPOINT ["/entrypoint.sh"] +# Default to a complete single-process cluster (master+volume+filer+S3+admin) +# so the image is usable out of the box — including in environments like +# GitHub Actions service containers that cannot pass arguments to the entrypoint. +# Override with any other subcommand at `docker run` / compose time. +CMD ["mini", "-dir=/data"] diff --git a/docker/Dockerfile.rocksdb_large b/docker/Dockerfile.rocksdb_large index 6013aacf9..0274d2940 100644 --- a/docker/Dockerfile.rocksdb_large +++ b/docker/Dockerfile.rocksdb_large @@ -68,3 +68,8 @@ WORKDIR /data # Entrypoint will handle permission fixes and user switching ENTRYPOINT ["/entrypoint.sh"] +# Default to a complete single-process cluster (master+volume+filer+S3+admin) +# so the image is usable out of the box — including in environments like +# GitHub Actions service containers that cannot pass arguments to the entrypoint. +# Override with any other subcommand at `docker run` / compose time. +CMD ["mini", "-dir=/data"] diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 6632f6645..7ce0595ec 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -37,17 +37,21 @@ if [ "$(id -u)" = "0" ]; then fi isArgPassed() { + # Match both `-flag` and `--flag` (and their `=value` forms): the Go fla9 + # library accepts both, and users may pick either form on the CLI. arg="$1" argWithEqualSign="$1=" + argDouble="-$1" + argDoubleWithEqualSign="-$1=" shift while [ $# -gt 0 ]; do passedArg="$1" shift case $passedArg in - "$arg") + "$arg"|"$argDouble") return 0 ;; - "$argWithEqualSign"*) + "$argWithEqualSign"*|"$argDoubleWithEqualSign"*) return 0 ;; esac @@ -95,6 +99,15 @@ case "$1" in exec /usr/bin/weed -logtostderr=true server $ARGS $@ ;; + 'mini') + ARGS="-dir=/data" + if isArgPassed "-dir" "$@"; then + ARGS="" + fi + shift + exec /usr/bin/weed -logtostderr=true mini $ARGS $@ + ;; + 'filer') ARGS="" shift