mirror of
https://github.com/MatthewL246/pretendo-docker.git
synced 2026-05-06 13:45:12 -05:00
20 lines
704 B
Bash
Executable File
20 lines
704 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# shellcheck source=./framework.sh
|
|
source "$(dirname "$(realpath "$0")")/framework.sh"
|
|
parse_arguments "$@"
|
|
|
|
mongodb_init_script=$(cat "$git_base_dir/scripts/run-in-container/mongodb-init.js")
|
|
|
|
docker compose up -d mongodb
|
|
|
|
# This won't work in /docker-entrypoint-initdb.d/ because MongoDB is in a
|
|
# special init state where it will refuse to resolve anything but localhost.
|
|
# This needs to be run after it initializes.
|
|
# https://github.com/docker-library/mongo/issues/339
|
|
|
|
run_command_until_success "docker compose exec mongodb mongosh --eval 'db.adminCommand(\"ping\")'" \
|
|
"Waiting for MongoDB to be ready..."
|
|
|
|
docker compose exec mongodb mongosh --eval "$mongodb_init_script"
|