UNCLASSIFIED

Commit e1630ff4 authored by Jeffrey Weatherford's avatar Jeffrey Weatherford
Browse files

Merge branch 'wingkwan.lau-development-patch-94977' into 'development'

Update Dockerfile, scripts/createuser.sh, hardening_manifest.yaml files

See merge request !17
parents e511954f 5a78b83b
Pipeline #440313 passed with stages
in 10 minutes and 31 seconds
...@@ -18,6 +18,9 @@ RUN mkdir -p $WORKING_DIR ...@@ -18,6 +18,9 @@ RUN mkdir -p $WORKING_DIR
# copy over the script to make permissions compatible with OpenShift # copy over the script to make permissions compatible with OpenShift
COPY scripts/fix-permissions.sh /usr/local/bin COPY scripts/fix-permissions.sh /usr/local/bin
# copy create user script
COPY scripts/createuser.sh /docker-entrypoint-initdb.d/
# ensure the script is executable # ensure the script is executable
RUN chmod a+x /usr/local/bin/fix-permissions.sh RUN chmod a+x /usr/local/bin/fix-permissions.sh
...@@ -26,12 +29,15 @@ RUN fix-permissions.sh ${DATA_DIR} -P && \ ...@@ -26,12 +29,15 @@ RUN fix-permissions.sh ${DATA_DIR} -P && \
fix-permissions.sh ${CONFIG_DIR} -P && \ fix-permissions.sh ${CONFIG_DIR} -P && \
fix-permissions.sh ${WORKING_DIR} -P fix-permissions.sh ${WORKING_DIR} -P
RUN ls -ltrh ${DATA_DIR}
RUN ls -ltrh ${CONFIG_DIR}
RUN ls -ltrh ${WORKING_DIR}
# set home directory to persistent volume directory # set home directory to persistent volume directory
ENV HOME=/var/lib/mongodb/data ENV HOME=/var/lib/mongodb/data
# ensure folder is writable
RUN chown -R mongodb:mongodb /usr/local/bin
# switch back to mongodb (for non-containerized environments) # switch back to mongodb (for non-containerized environments)
USER mongodb:mongodb USER mongodb:mongodb
HEALTHCHECK --interval=15s --timeout=3s CMD echo 'db.runCommand("ping").ok' | mongo localhost:27017/test
# <application name> # aap-mongo
Project template for all Iron Bank container repositories. Mongo Image that is set up to work on AAP enviornment on Openshift
\ No newline at end of file
...@@ -7,7 +7,7 @@ name: "diat/aap-mongo" ...@@ -7,7 +7,7 @@ name: "diat/aap-mongo"
# The most specific version should be the first tag and will be shown # The most specific version should be the first tag and will be shown
# on ironbank.dso.mil # on ironbank.dso.mil
tags: tags:
- "14.1" - "15.1"
- "latest" - "latest"
# Build args passed to Dockerfile ARGs # Build args passed to Dockerfile ARGs
...@@ -29,7 +29,7 @@ labels: ...@@ -29,7 +29,7 @@ labels:
# Name of the distributing entity, organization or individual # Name of the distributing entity, organization or individual
org.opencontainers.image.vendor: "aap-mongo" org.opencontainers.image.vendor: "aap-mongo"
# Authoritative version of the software # Authoritative version of the software
org.opencontainers.image.version: "14.1" org.opencontainers.image.version: "15.1"
# Keywords to help with search (ex. "cicd,gitops,golang") # Keywords to help with search (ex. "cicd,gitops,golang")
mil.dso.ironbank.image.keywords: "aap,mongo,aap-mongo,aapmongo,mongodb,aap-mongodb,atlas,diat" mil.dso.ironbank.image.keywords: "aap,mongo,aap-mongo,aapmongo,mongodb,aap-mongodb,atlas,diat"
# This value can be "opensource" or "commercial" # This value can be "opensource" or "commercial"
......
#!/bin/sh
echo "Initializing database $MONGO_INITDB_DATABASE and creating database user $MONGODB_USER"
mongo=( mongo --host 127.0.0.1 --port 27017 --quiet )
"${mongo[@]}" "$MONGO_INITDB_DATABASE" <<-EOJS
db.createUser({
user: $(_js_escape "$MONGODB_USER"),
pwd: $(_js_escape "$MONGODB_PASSWORD"),
roles: [ { role: 'readWrite', db: $(_js_escape "$MONGO_INITDB_DATABASE") } ]
})
EOJS
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment