I’m trying out the new feature to run atlas search locally. I got it to work with docker compose but was wondering if there is an option to add an entrypoint like you would in the mongo docker image:
environment:
- MONGO_INITDB_ROOT_USERNAME=root
- MONGO_INITDB_ROOT_PASSWORD=roto
- MONGO_INITDB_DATABASE=test
- MONGO_CORE_PASSWORD=test
volumes:
- ./.data/mongo:/data/db
- ./dev/mongo-init:/docker-entrypoint-initdb.d
where ./dev/mongo-init contains a script to add the user and db:
set -e
mongosh -u $MONGO_INITDB_ROOT_USERNAME -p $MONGO_INITDB_ROOT_PASSWORD <<EOF
use $MONGO_INITDB_DATABASE
db.createCollection("dont_delete_me");
db.createUser({
user: 'test',
pwd: '${MONGO_CORE_PASSWORD}',
roles: [{
role: 'readWrite',
db: 'test'
}]
});
EOF
Or would there be another easy way to accomplish this in the docker compose with creating a custom dockerfile?