-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDockerfile
27 lines (20 loc) · 835 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
ARG TAG=latest
FROM mongo:$TAG
ENV MONGO_AUTH_CONFIG="./config/config.json"
## To set root user/password and enable auth:
## -Set user/pass values, OR
## -Set the _FILE vars to read the values from docker secrets, etc
## -You can set the vars here, in the Docker run command, or in a Docker compose file
##
## To also create DB user(s), modify the config.json file - see comments in setup.js
## specify root user/pass values
# ENV MONGO_INITDB_ROOT_USERNAME=admin
# ENV MONGO_INITDB_ROOT_PASSWORD=P@$$w0rd123
## OR
## specify files containing the user/pass values
# ENV MONGO_INITDB_ROOT_USERNAME_FILE=/run/secrets/mongo_admin_user
# ENV MONGO_INITDB_ROOT_PASSWORD_FILE=/run/secrets/mongo_admin_password
WORKDIR /tmp/mongo-auth
COPY ${MONGO_AUTH_CONFIG} config.json
WORKDIR /docker-entrypoint-initdb.d
COPY setup.js setup.js