Maybe with a shell script...
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -4,7 +4,7 @@ ARG PORT=9001
|
||||
|
||||
## mongo build stage
|
||||
FROM mongo:$MONGO_VERSION AS database
|
||||
COPY mongo-init.js /docker-entrypoint-initdb.d
|
||||
COPY mongo-init.sh /docker-entrypoint-initdb.d
|
||||
|
||||
## stage one, build the service
|
||||
FROM node:20-alpine AS build
|
||||
|
||||
14
mongo-init.sh
Normal file
14
mongo-init.sh
Normal file
@@ -0,0 +1,14 @@
|
||||
set -e
|
||||
|
||||
mongo <<EOF
|
||||
use $MONGO_INITDB_DATABASE
|
||||
|
||||
db.createUser({
|
||||
user: '$DB_USERNAME',
|
||||
pwd: '$DB_PASSWORD',
|
||||
roles: [{
|
||||
role: 'readWrite',
|
||||
db: '$MONGO_INITDB_DATABASE'
|
||||
}]
|
||||
})
|
||||
EOF
|
||||
Reference in New Issue
Block a user