-
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.
- Loading branch information
Ken
committed
Apr 3, 2024
1 parent
6426286
commit 0045c2d
Showing
7 changed files
with
563 additions
and
14 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
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
119 changes: 119 additions & 0 deletions
119
test/MinimalDomainEvents.Outbox.MongoDb.UnitTests/Dockerfile
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 |
---|---|---|
@@ -0,0 +1,119 @@ | ||
# | ||
# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" | ||
# | ||
# PLEASE DO NOT EDIT IT DIRECTLY. | ||
# | ||
|
||
FROM ubuntu:jammy | ||
|
||
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added | ||
RUN set -eux; \ | ||
groupadd --gid 999 --system mongodb; \ | ||
useradd --uid 999 --system --gid mongodb --home-dir /data/db mongodb; \ | ||
mkdir -p /data/db /data/configdb; \ | ||
chown -R mongodb:mongodb /data/db /data/configdb | ||
|
||
RUN set -eux; \ | ||
apt-get update; \ | ||
apt-get install -y --no-install-recommends \ | ||
ca-certificates \ | ||
jq \ | ||
numactl \ | ||
procps \ | ||
; \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# grab gosu for easy step-down from root (https://github.com/tianon/gosu/releases) | ||
ENV GOSU_VERSION 1.17 | ||
# grab "js-yaml" for parsing mongod's YAML config files (https://github.com/nodeca/js-yaml/releases) | ||
ENV JSYAML_VERSION 3.13.1 | ||
|
||
RUN set -eux; \ | ||
\ | ||
savedAptMark="$(apt-mark showmanual)"; \ | ||
apt-get update; \ | ||
apt-get install -y --no-install-recommends \ | ||
gnupg \ | ||
wget \ | ||
; \ | ||
rm -rf /var/lib/apt/lists/*; \ | ||
\ | ||
# download/install gosu | ||
dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \ | ||
wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch"; \ | ||
wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc"; \ | ||
export GNUPGHOME="$(mktemp -d)"; \ | ||
gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ | ||
gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \ | ||
gpgconf --kill all; \ | ||
rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \ | ||
\ | ||
# download/install js-yaml | ||
mkdir -p /opt/js-yaml/; \ | ||
wget -O /opt/js-yaml/js-yaml.js "https://github.com/nodeca/js-yaml/raw/${JSYAML_VERSION}/dist/js-yaml.js"; \ | ||
wget -O /opt/js-yaml/package.json "https://github.com/nodeca/js-yaml/raw/${JSYAML_VERSION}/package.json"; \ | ||
ln -s /opt/js-yaml/js-yaml.js /js-yaml.js; \ | ||
# TODO some sort of download verification here | ||
\ | ||
# download/install MongoDB PGP keys | ||
export GNUPGHOME="$(mktemp -d)"; \ | ||
wget -O KEYS 'https://pgp.mongodb.com/server-7.0.asc'; \ | ||
gpg --batch --import KEYS; \ | ||
mkdir -p /etc/apt/keyrings; \ | ||
gpg --batch --export --armor 'E58830201F7DD82CD808AA84160D26BB1785BA38' > /etc/apt/keyrings/mongodb.asc; \ | ||
gpgconf --kill all; \ | ||
rm -rf "$GNUPGHOME" KEYS; \ | ||
\ | ||
apt-mark auto '.*' > /dev/null; \ | ||
apt-mark manual $savedAptMark > /dev/null; \ | ||
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ | ||
\ | ||
# smoke test | ||
chmod +x /usr/local/bin/gosu; \ | ||
gosu --version; \ | ||
gosu nobody true | ||
|
||
RUN mkdir /docker-entrypoint-initdb.d | ||
|
||
# Allow build-time overrides (eg. to build image with MongoDB Enterprise version) | ||
# Options for MONGO_PACKAGE: mongodb-org OR mongodb-enterprise | ||
# Options for MONGO_REPO: repo.mongodb.org OR repo.mongodb.com | ||
# Example: docker build --build-arg MONGO_PACKAGE=mongodb-enterprise --build-arg MONGO_REPO=repo.mongodb.com . | ||
ARG MONGO_PACKAGE=mongodb-org | ||
ARG MONGO_REPO=repo.mongodb.org | ||
ENV MONGO_PACKAGE=${MONGO_PACKAGE} MONGO_REPO=${MONGO_REPO} | ||
|
||
ENV MONGO_MAJOR 7.0 | ||
RUN echo "deb [ signed-by=/etc/apt/keyrings/mongodb.asc ] http://$MONGO_REPO/apt/ubuntu jammy/${MONGO_PACKAGE%-unstable}/$MONGO_MAJOR multiverse" | tee "/etc/apt/sources.list.d/${MONGO_PACKAGE%-unstable}.list" | ||
|
||
# https://docs.mongodb.org/master/release-notes/7.0/ | ||
ENV MONGO_VERSION 7.0.7 | ||
# 03/13/2024, https://github.com/mongodb/mongo/tree/cfb08e1ab7ef741b4abdd0638351b322514c45bd | ||
|
||
RUN set -x \ | ||
# installing "mongodb-enterprise" pulls in "tzdata" which prompts for input | ||
&& export DEBIAN_FRONTEND=noninteractive \ | ||
&& apt-get update \ | ||
&& apt-get install -y \ | ||
${MONGO_PACKAGE}=$MONGO_VERSION \ | ||
${MONGO_PACKAGE}-server=$MONGO_VERSION \ | ||
${MONGO_PACKAGE}-shell=$MONGO_VERSION \ | ||
${MONGO_PACKAGE}-mongos=$MONGO_VERSION \ | ||
${MONGO_PACKAGE}-tools=$MONGO_VERSION \ | ||
${MONGO_PACKAGE}-database=$MONGO_VERSION \ | ||
${MONGO_PACKAGE}-database-tools-extra=$MONGO_VERSION \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& rm -rf /var/lib/mongodb \ | ||
&& mv /etc/mongod.conf /etc/mongod.conf.orig | ||
|
||
VOLUME /data/db /data/configdb | ||
|
||
# ensure that if running as custom user that "mongosh" has a valid "HOME" | ||
# https://github.com/docker-library/mongo/issues/524 | ||
ENV HOME /data/db | ||
|
||
COPY docker-entrypoint.sh /usr/local/bin/ | ||
ENTRYPOINT ["docker-entrypoint.sh --replSet rs0"] | ||
|
||
EXPOSE 27017 | ||
CMD ["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
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
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
Oops, something went wrong.