forked from maleck13/mongodb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Saves lots of developer time running `make` / `docker build`, by reordering instructions to better use the cache when we make changes to scripts, and also reduce the number of layers leading to a smaller time to build. For instance, a developer might run the command below multiple times in a row while making changes to the scripts that are copied into the image: make VERSION=3.2 SKIP_SQUASH=1 We've moving informative instructions close together at the top, while moving `ADD root /` down as much as possible, so that changes to the scripts invalidate less cached layers.
- Loading branch information
1 parent
61f070b
commit 9f38dd1
Showing
2 changed files
with
53 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,16 +11,28 @@ MAINTAINER SoftwareCollections.org <[email protected]> | |
# * $MONGODB_DATABASE - Name of the database to create | ||
# * $MONGODB_ADMIN_PASSWORD - Password of the MongoDB Admin | ||
|
||
ENV MONGODB_VERSION=3.2 \ | ||
HOME=/var/lib/mongodb | ||
|
||
LABEL io.k8s.description="MongoDB is a scalable, high-performance, open source NoSQL database." \ | ||
io.k8s.display-name="MongoDB 3.2" \ | ||
io.openshift.expose-services="27017:mongodb" \ | ||
io.openshift.tags="database,mongodb,rh-mongodb32" | ||
|
||
ENV MONGODB_VERSION=3.2 \ | ||
# Set paths to avoid hard-coding them in scripts. | ||
HOME=/var/lib/mongodb \ | ||
CONTAINER_SCRIPTS_PATH=/usr/share/container-scripts/mongodb \ | ||
MONGODB_PREFIX=/opt/rh/rh-mongodb32/root/usr \ | ||
# Incantations to enable Software Collections on `bash` and `sh -i`. | ||
ENABLED_COLLECTIONS=rh-mongodb32 \ | ||
BASH_ENV="\${CONTAINER_SCRIPTS_PATH}/scl_enable" \ | ||
ENV="\${CONTAINER_SCRIPTS_PATH}/scl_enable" \ | ||
PROMPT_COMMAND=". \${CONTAINER_SCRIPTS_PATH}/scl_enable" | ||
|
||
EXPOSE 27017 | ||
|
||
|
||
ENTRYPOINT ["container-entrypoint"] | ||
CMD ["run-mongod"] | ||
|
||
# Due to the https://bugzilla.redhat.com/show_bug.cgi?id=1206151, | ||
# the whole /var/lib/mongodb/ dir has to be chown-ed. | ||
RUN yum install -y centos-release-scl-rh && \ | ||
|
@@ -34,26 +46,11 @@ RUN yum install -y centos-release-scl-rh && \ | |
chmod g+w -R /var/opt/rh/rh-mongodb32/lib/mongodb && \ | ||
chmod -R g+rwx /var/lib/mongodb | ||
|
||
# Get prefix path and path to scripts rather than hard-code them in scripts | ||
ENV CONTAINER_SCRIPTS_PATH=/usr/share/container-scripts/mongodb \ | ||
MONGODB_PREFIX=/opt/rh/rh-mongodb32/root/usr \ | ||
ENABLED_COLLECTIONS=rh-mongodb32 | ||
|
||
# When bash is started non-interactively, to run a shell script, for example it | ||
# looks for this variable and source the content of this file. This will enable | ||
# the SCL for all scripts without need to do 'scl enable'. | ||
ENV BASH_ENV=${CONTAINER_SCRIPTS_PATH}/scl_enable \ | ||
ENV=${CONTAINER_SCRIPTS_PATH}/scl_enable \ | ||
PROMPT_COMMAND=". ${CONTAINER_SCRIPTS_PATH}/scl_enable" | ||
VOLUME ["/var/lib/mongodb/data"] | ||
|
||
ADD root / | ||
|
||
# Container setup | ||
RUN touch /etc/mongod.conf && chown mongodb:0 /etc/mongod.conf && /usr/libexec/fix-permissions /etc/mongod.conf | ||
|
||
VOLUME ["/var/lib/mongodb/data"] | ||
|
||
USER 184 | ||
|
||
ENTRYPOINT ["container-entrypoint"] | ||
CMD ["run-mongod"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters