Skip to content

Commit 1265643

Browse files
committed
Add dockerfiles to the public dir
1 parent ada6a0e commit 1265643

File tree

4 files changed

+416
-0
lines changed

4 files changed

+416
-0
lines changed
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
FROM --platform=${BUILDPLATFORM} registry.access.redhat.com/ubi9/ubi-minimal AS tools_downloader
2+
3+
ARG TARGETPLATFORM
4+
ARG mongodb_tools_url
5+
ARG mongodb_tools_version_s390x
6+
ARG mongodb_tools_version_ppc64le
7+
ARG mongodb_tools_version_amd64
8+
ARG mongodb_tools_version_arm64
9+
10+
RUN microdnf -y update --nodocs \
11+
&& microdnf -y install --nodocs tar gzip \
12+
&& microdnf clean all
13+
14+
RUN case ${TARGETPLATFORM} in \
15+
"linux/amd64") export MONGODB_TOOLS_VERSION=${mongodb_tools_version_amd64} ;; \
16+
"linux/arm64") export MONGODB_TOOLS_VERSION=${mongodb_tools_version_arm64} ;; \
17+
"linux/s390x") export MONGODB_TOOLS_VERSION=${mongodb_tools_version_s390x} ;; \
18+
"linux/ppc64le") export MONGODB_TOOLS_VERSION=${mongodb_tools_version_ppc64le} ;; \
19+
esac \
20+
&& mkdir -p /tools \
21+
&& curl -o /tools/mongodb_tools.tgz "${mongodb_tools_url}/${MONGODB_TOOLS_VERSION}"
22+
23+
RUN tar xfz /tools/mongodb_tools.tgz \
24+
&& mv mongodb-database-tools-*/bin/* /tools \
25+
&& chmod +x /tools/* \
26+
&& rm /tools/mongodb_tools.tgz \
27+
&& rm -r mongodb-database-tools-*
28+
29+
FROM --platform=${BUILDPLATFORM} registry.access.redhat.com/ubi9/ubi-minimal AS agent_downloader
30+
31+
ARG TARGETPLATFORM
32+
ARG mongodb_agent_url
33+
ARG mongodb_agent_version_s390x
34+
ARG mongodb_agent_version_ppc64le
35+
ARG mongodb_agent_version_amd64
36+
ARG mongodb_agent_version_arm64
37+
38+
RUN microdnf -y update --nodocs \
39+
&& microdnf -y install --nodocs tar gzip \
40+
&& microdnf clean all
41+
42+
RUN case ${TARGETPLATFORM} in \
43+
"linux/amd64") export MONGODB_AGENT_VERSION=${mongodb_agent_version_amd64} ;; \
44+
"linux/arm64") export MONGODB_AGENT_VERSION=${mongodb_agent_version_arm64} ;; \
45+
"linux/s390x") export MONGODB_AGENT_VERSION=${mongodb_agent_version_s390x} ;; \
46+
"linux/ppc64le") export MONGODB_AGENT_VERSION=${mongodb_agent_version_ppc64le} ;; \
47+
esac \
48+
&& mkdir -p /agent \
49+
&& curl -o /agent/mongodb_agent.tgz "${mongodb_agent_url}/${MONGODB_AGENT_VERSION}"
50+
51+
RUN tar xfz /agent/mongodb_agent.tgz \
52+
&& mv mongodb-mms-automation-agent-*/mongodb-mms-automation-agent /agent/mongodb-agent \
53+
&& chmod +x /agent/mongodb-agent \
54+
&& rm /agent/mongodb_agent.tgz \
55+
&& rm -r mongodb-mms-automation-agent-*
56+
57+
FROM registry.access.redhat.com/ubi9/ubi-minimal
58+
59+
# Replace libcurl-minimal and curl-minimal with the full versions
60+
# https://bugzilla.redhat.com/show_bug.cgi?id=1994521
61+
RUN microdnf install -y libssh libpsl libbrotli \
62+
&& microdnf download curl libcurl \
63+
&& rpm -Uvh --nodeps --replacefiles "*curl*$( uname -i ).rpm" \
64+
&& microdnf remove -y libcurl-minimal curl-minimal
65+
66+
RUN microdnf install -y --disableplugin=subscription-manager --setopt=install_weak_deps=0 nss_wrapper
67+
# Copy-pasted from https://www.mongodb.com/docs/manual/tutorial/install-mongodb-enterprise-on-red-hat-tarball/
68+
RUN microdnf install -y --disableplugin=subscription-manager \
69+
cyrus-sasl cyrus-sasl-gssapi cyrus-sasl-plain krb5-libs openldap openssl xz-libs
70+
# Dependencies for the Agent
71+
RUN microdnf install -y --disableplugin=subscription-manager --setopt=install_weak_deps=0 \
72+
net-snmp \
73+
net-snmp-agent-libs
74+
RUN microdnf install -y --disableplugin=subscription-manager \
75+
hostname tar gzip procps jq \
76+
&& microdnf upgrade -y \
77+
&& rm -rf /var/lib/apt/lists/*
78+
79+
RUN mkdir -p /agent \
80+
&& mkdir -p /var/lib/mongodb-mms-automation \
81+
&& mkdir -p /var/log/mongodb-mms-automation/ \
82+
&& chmod -R +wr /var/log/mongodb-mms-automation/ \
83+
# ensure that the agent user can write the logs in OpenShift
84+
&& touch /var/log/mongodb-mms-automation/readiness.log \
85+
&& chmod ugo+rw /var/log/mongodb-mms-automation/readiness.log
86+
87+
# Copy scripts to a safe location that won't be overwritten by volume mount
88+
COPY ./docker/mongodb-kubernetes-init-database/content/LICENSE /licenses/LICENSE
89+
COPY ./docker/mongodb-agent/agent-launcher-shim.sh /usr/local/bin/agent-launcher-shim.sh
90+
COPY ./docker/mongodb-agent/setup-agent-files.sh /usr/local/bin/setup-agent-files.sh
91+
COPY ./docker/mongodb-agent/dummy-probe.sh /usr/local/bin/dummy-probe.sh
92+
COPY ./docker/mongodb-agent/dummy-readinessprobe /usr/local/bin/dummy-readinessprobe
93+
94+
RUN mkdir -p /var/lib/automation/config \
95+
&& chmod -R +r /var/lib/automation/config
96+
97+
RUN mkdir -p /tools /agent
98+
99+
COPY --from=tools_downloader "/tools/" /tools/
100+
COPY --from=agent_downloader "/agent/" /agent/
101+
102+
ARG version
103+
104+
LABEL name="MongoDB Agent" \
105+
version="${version}" \
106+
summary="MongoDB Agent" \
107+
description="MongoDB Agent" \
108+
vendor="MongoDB" \
109+
release="1" \
110+
maintainer="support@mongodb.com"
111+
112+
USER 2000
113+
CMD ["/agent/mongodb-agent", "-cluster=/var/lib/automation/config/automation-config.json"]
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
FROM --platform=${BUILDPLATFORM} registry.access.redhat.com/ubi9/ubi-minimal AS tools_downloader
2+
3+
ARG TARGETPLATFORM
4+
ARG mongodb_tools_url
5+
ARG mongodb_tools_version_s390x
6+
ARG mongodb_tools_version_ppc64le
7+
ARG mongodb_tools_version_amd64
8+
ARG mongodb_tools_version_arm64
9+
10+
RUN microdnf -y update --nodocs \
11+
&& microdnf -y install --nodocs tar gzip \
12+
&& microdnf clean all
13+
14+
RUN case ${TARGETPLATFORM} in \
15+
"linux/amd64") export MONGODB_TOOLS_VERSION=${mongodb_tools_version_amd64} ;; \
16+
"linux/arm64") export MONGODB_TOOLS_VERSION=${mongodb_tools_version_arm64} ;; \
17+
"linux/s390x") export MONGODB_TOOLS_VERSION=${mongodb_tools_version_s390x} ;; \
18+
"linux/ppc64le") export MONGODB_TOOLS_VERSION=${mongodb_tools_version_ppc64le} ;; \
19+
esac \
20+
&& mkdir -p /tools \
21+
&& curl -o /tools/mongodb_tools.tgz "${mongodb_tools_url}/${MONGODB_TOOLS_VERSION}"
22+
23+
RUN tar xfz /tools/mongodb_tools.tgz \
24+
&& mv mongodb-database-tools-*/bin/* /tools \
25+
&& chmod +x /tools/* \
26+
&& rm /tools/mongodb_tools.tgz \
27+
&& rm -r mongodb-database-tools-*
28+
29+
FROM --platform=${BUILDPLATFORM} registry.access.redhat.com/ubi9/ubi-minimal AS agent_downloader
30+
31+
ARG TARGETPLATFORM
32+
ARG mongodb_agent_url
33+
ARG mongodb_agent_version_s390x
34+
ARG mongodb_agent_version_ppc64le
35+
ARG mongodb_agent_version_amd64
36+
ARG mongodb_agent_version_arm64
37+
38+
RUN microdnf -y update --nodocs \
39+
&& microdnf -y install --nodocs tar gzip \
40+
&& microdnf clean all
41+
42+
RUN case ${TARGETPLATFORM} in \
43+
"linux/amd64") export MONGODB_AGENT_VERSION=${mongodb_agent_version_amd64} ;; \
44+
"linux/arm64") export MONGODB_AGENT_VERSION=${mongodb_agent_version_arm64} ;; \
45+
"linux/s390x") export MONGODB_AGENT_VERSION=${mongodb_agent_version_s390x} ;; \
46+
"linux/ppc64le") export MONGODB_AGENT_VERSION=${mongodb_agent_version_ppc64le} ;; \
47+
esac \
48+
&& mkdir -p /agent \
49+
&& curl -o /agent/mongodb_agent.tgz "${mongodb_agent_url}/${MONGODB_AGENT_VERSION}"
50+
51+
RUN tar xfz /agent/mongodb_agent.tgz \
52+
&& mv mongodb-mms-automation-agent-*/mongodb-mms-automation-agent /agent/mongodb-agent \
53+
&& chmod +x /agent/mongodb-agent \
54+
&& rm /agent/mongodb_agent.tgz \
55+
&& rm -r mongodb-mms-automation-agent-*
56+
57+
FROM registry.access.redhat.com/ubi9/ubi-minimal
58+
59+
# Replace libcurl-minimal and curl-minimal with the full versions
60+
# https://bugzilla.redhat.com/show_bug.cgi?id=1994521
61+
RUN microdnf install -y libssh libpsl libbrotli \
62+
&& microdnf download curl libcurl \
63+
&& rpm -Uvh --nodeps --replacefiles "*curl*$( uname -i ).rpm" \
64+
&& microdnf remove -y libcurl-minimal curl-minimal
65+
66+
RUN microdnf install -y --disableplugin=subscription-manager --setopt=install_weak_deps=0 nss_wrapper
67+
# Copy-pasted from https://www.mongodb.com/docs/manual/tutorial/install-mongodb-enterprise-on-red-hat-tarball/
68+
RUN microdnf install -y --disableplugin=subscription-manager \
69+
cyrus-sasl cyrus-sasl-gssapi cyrus-sasl-plain krb5-libs openldap openssl xz-libs
70+
# Dependencies for the Agent
71+
RUN microdnf install -y --disableplugin=subscription-manager --setopt=install_weak_deps=0 \
72+
net-snmp \
73+
net-snmp-agent-libs
74+
RUN microdnf install -y --disableplugin=subscription-manager \
75+
hostname tar gzip procps jq \
76+
&& microdnf upgrade -y \
77+
&& rm -rf /var/lib/apt/lists/*
78+
79+
RUN mkdir -p /agent \
80+
&& mkdir -p /var/lib/mongodb-mms-automation \
81+
&& mkdir -p /var/log/mongodb-mms-automation/ \
82+
&& chmod -R +wr /var/log/mongodb-mms-automation/ \
83+
# ensure that the agent user can write the logs in OpenShift
84+
&& touch /var/log/mongodb-mms-automation/readiness.log \
85+
&& chmod ugo+rw /var/log/mongodb-mms-automation/readiness.log
86+
87+
# Copy scripts to a safe location that won't be overwritten by volume mount
88+
COPY ./docker/mongodb-kubernetes-init-database/content/LICENSE /licenses/LICENSE
89+
COPY ./docker/mongodb-agent/agent-launcher-shim.sh /usr/local/bin/agent-launcher-shim.sh
90+
COPY ./docker/mongodb-agent/setup-agent-files.sh /usr/local/bin/setup-agent-files.sh
91+
COPY ./docker/mongodb-agent/dummy-probe.sh /usr/local/bin/dummy-probe.sh
92+
COPY ./docker/mongodb-agent/dummy-readinessprobe /usr/local/bin/dummy-readinessprobe
93+
94+
RUN mkdir -p /var/lib/automation/config \
95+
&& chmod -R +r /var/lib/automation/config
96+
97+
RUN mkdir -p /tools /agent
98+
99+
COPY --from=tools_downloader "/tools/" /tools/
100+
COPY --from=agent_downloader "/agent/" /agent/
101+
102+
ARG version
103+
104+
LABEL name="MongoDB Agent" \
105+
version="${version}" \
106+
summary="MongoDB Agent" \
107+
description="MongoDB Agent" \
108+
vendor="MongoDB" \
109+
release="1" \
110+
maintainer="support@mongodb.com"
111+
112+
USER 2000
113+
CMD ["/agent/mongodb-agent", "-cluster=/var/lib/automation/config/automation-config.json"]
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# Build compilable stuff
2+
3+
FROM public.ecr.aws/docker/library/golang:1.24 AS readiness_builder
4+
COPY . /go/src/github.com/mongodb/mongodb-kubernetes
5+
WORKDIR /go/src/github.com/mongodb/mongodb-kubernetes
6+
7+
RUN CGO_ENABLED=0 go build -a -buildvcs=false -o /data/scripts/mmsconfiguration ./docker/mongodb-kubernetes-init-ops-manager/mmsconfiguration/edit_mms_configuration.go
8+
RUN CGO_ENABLED=0 go build -a -buildvcs=false -o /data/scripts/backup-daemon-readiness-probe ./docker/mongodb-kubernetes-init-ops-manager/backupdaemon_readinessprobe/backupdaemon_readiness.go
9+
10+
# Move binaries and scripts
11+
FROM scratch AS base
12+
13+
COPY --from=readiness_builder /data/scripts/mmsconfiguration /data/scripts/mmsconfiguration
14+
COPY --from=readiness_builder /data/scripts/backup-daemon-readiness-probe /data/scripts/backup-daemon-readiness-probe
15+
16+
# After v2.0, when non-Static Agent images will be removed, please ensure to copy those files
17+
# into ./docker/mongodb-enterprise-ops-manager directory. Leaving it this way will make the maintenance easier.
18+
COPY ./docker/mongodb-kubernetes-init-ops-manager/scripts/docker-entry-point.sh /data/scripts
19+
COPY ./docker/mongodb-kubernetes-init-ops-manager/scripts/backup-daemon-liveness-probe.sh /data/scripts
20+
COPY ./docker/mongodb-kubernetes-init-ops-manager/LICENSE /data/licenses/mongodb-enterprise-ops-manager
21+
22+
FROM registry.access.redhat.com/ubi9/ubi-minimal
23+
24+
ARG version
25+
ARG om_download_url
26+
27+
LABEL name="MongoDB Enterprise Ops Manager" \
28+
maintainer="support@mongodb.com" \
29+
vendor="MongoDB" \
30+
version=${version} \
31+
release="1" \
32+
summary="MongoDB Enterprise Ops Manager Image" \
33+
description="MongoDB Enterprise Ops Manager"
34+
35+
ENV MMS_HOME=/mongodb-ops-manager
36+
ENV MMS_PROP_FILE=${MMS_HOME}/conf/conf-mms.properties
37+
ENV MMS_CONF_FILE=${MMS_HOME}/conf/mms.conf
38+
ENV MMS_LOG_DIR=${MMS_HOME}/logs
39+
ENV MMS_TMP_DIR=${MMS_HOME}/tmp
40+
41+
EXPOSE 8080
42+
43+
# OpsManager docker image needs to have the MongoDB dependencies because the
44+
# backup daemon is running its database locally
45+
46+
# Replace libcurl-minimal and curl-minimal with the full versions
47+
# https://bugzilla.redhat.com/show_bug.cgi?id=1994521
48+
RUN microdnf install -y libssh libpsl libbrotli \
49+
&& microdnf download curl libcurl \
50+
&& rpm -Uvh --nodeps --replacefiles "*curl*$( uname -i ).rpm" \
51+
&& microdnf remove -y libcurl-minimal curl-minimal
52+
53+
RUN microdnf install --disableplugin=subscription-manager -y \
54+
cyrus-sasl \
55+
cyrus-sasl-gssapi \
56+
cyrus-sasl-plain \
57+
krb5-libs \
58+
libpcap \
59+
lm_sensors-libs \
60+
net-snmp \
61+
net-snmp-agent-libs \
62+
openldap \
63+
openssl \
64+
tar \
65+
rpm-libs \
66+
net-tools \
67+
procps-ng \
68+
ncurses
69+
70+
COPY --from=base /data/licenses /licenses/
71+
COPY --from=base /data/scripts /opt/scripts
72+
73+
RUN curl --fail -L -o ops_manager.tar.gz ${om_download_url} \
74+
&& tar -xzf ops_manager.tar.gz \
75+
&& rm ops_manager.tar.gz \
76+
&& mv mongodb-mms* "${MMS_HOME}"
77+
78+
# permissions
79+
RUN chmod -R 0777 "${MMS_LOG_DIR}" \
80+
&& chmod -R 0777 "${MMS_TMP_DIR}" \
81+
&& chmod -R 0775 "${MMS_HOME}/conf" \
82+
&& chmod -R 0775 "${MMS_HOME}/jdk" \
83+
&& mkdir "${MMS_HOME}/mongodb-releases/" \
84+
&& chmod -R 0775 "${MMS_HOME}/mongodb-releases" \
85+
&& chmod -R 0777 "${MMS_CONF_FILE}" \
86+
&& chmod -R 0777 "${MMS_PROP_FILE}"
87+
88+
# The "${MMS_HOME}/conf" will be populated by the docker-entry-point.sh.
89+
# For now we need to move into the templates directory.
90+
RUN cp -r "${MMS_HOME}/conf" "${MMS_HOME}/conf-template"
91+
92+
USER 2000
93+
94+
# operator to change the entrypoint to: /mongodb-ops-manager/bin/mongodb-mms start_mms (or a wrapper around this)
95+
ENTRYPOINT [ "sleep infinity" ]

0 commit comments

Comments
 (0)