First Commit with Dockerfile and associated files

This commit is contained in:
Patrick McDonagh
2017-05-02 15:23:23 -05:00
commit 316dd0da72
3 changed files with 77 additions and 0 deletions

15
Dockerfile Normal file
View File

@@ -0,0 +1,15 @@
FROM ubuntu:latest
# Install MongoDB
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
RUN echo "deb http://repo.mongodb.org/apt/ubuntu $(cat /etc/lsb-release | grep DISTRIB_CODENAME | cut -d= -f2)/mongodb-org/3.4 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-3.4.list
RUN apt-get update && apt-get install -y mongodb-org
RUN mkdir -p /data/db
COPY setup_mongo_admin.js /tmp/setup_mongo_admin.js
RUN mongod --fork --logpath=/var/log/mongodb.log && sleep 5 && mongo < /tmp/setup_mongo_admin.js
# COPY mongod.conf /etc/mongod.conf
EXPOSE 27107
CMD ["/usr/bin/mongod"]

42
mongod.conf Normal file
View File

@@ -0,0 +1,42 @@
# mongod.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# Where and how to store data.
storage:
dbPath: /var/lib/mongodb
journal:
enabled: true
# engine:
# mmapv1:
# wiredTiger:
# where to write logging data.
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log
# network interfaces
net:
port: 27017
bindIp: 127.0.0.1
#processManagement:
security:
authorization: enabled
#operationProfiling:
#replication:
#sharding:
## Enterprise-Only Options:
#auditLog:
#snmp:

20
setup_mongo_admin.js Normal file
View File

@@ -0,0 +1,20 @@
admin = db.getSiblingDB('admin');
admin.createUser(
{
user: "admin",
pwd: "HenryPump@1903",
roles: [ { role: "userAdminAnyDatabase", db: "admin" } ]
}
);
poc = db.getSiblingDB('poc');
poc.createUser({
user: "poc_www",
pwd: "HenryPump1903",
roles: [ { role: "readWrite", db: "poc" } ]
});
poc.createUser({
user: "poc_java",
pwd: "HenryPump@1903",
roles: [ { role: "readWrite", db: "poc" } ]
});