1
1
ARG imagebase
2
- FROM ${imagebase} as base
2
+ FROM ${imagebase} AS base
3
+
4
+ FROM registry.access.redhat.com/ubi9/ubi-minimal AS builder
5
+
6
+ RUN microdnf install -y tar gzip && microdnf clean all
7
+
8
+ COPY --from=base /data/mongodb_tools_ubi.tgz /data/mongodb_agent_ubi.tgz /tmp/
9
+
10
+ RUN tar xfz /tmp/mongodb_tools_ubi.tgz -C /opt && \
11
+ tar xfz /tmp/mongodb_agent_ubi.tgz -C /opt && \
12
+ rm /tmp/*.tgz
13
+
14
+ RUN chmod +x /opt/mongodb-mms-automation-agent-*/mongodb-mms-automation-agent
15
+ RUN chmod +x /opt/mongodb-database-tools-*/bin/*
16
+
17
+ COPY --from=base /data/probe.sh \
18
+ /data/readinessprobe \
19
+ /data/version-upgrade-hook \
20
+ /data/agent-launcher-lib.sh \
21
+ /data/agent-launcher.sh \
22
+ /opt/scripts/
23
+
24
+ RUN chmod +x /opt/scripts/*
3
25
4
26
FROM registry.access.redhat.com/ubi9/ubi-minimal
5
27
@@ -13,51 +35,37 @@ LABEL name="MongoDB Agent" \
13
35
release="1" \
14
36
15
37
16
- COPY --from=base /data/probe.sh /opt/scripts/probe.sh
17
- COPY --from=base /data/readinessprobe /opt/scripts/readinessprobe
18
- COPY --from=base /data/version-upgrade-hook /opt/scripts/version-upgrade-hook
19
- COPY --from=base /data/agent-launcher-lib.sh /opt/scripts/agent-launcher-lib.sh
20
- COPY --from=base /data/agent-launcher.sh /opt/scripts/agent-launcher.sh
21
- COPY --from=base /data/LICENSE /licenses/LICENSE
22
-
23
- # Replace libcurl-minimal and curl-minimal with the full versions
24
- # https://bugzilla.redhat.com/show_bug.cgi?id=1994521
25
- RUN microdnf install -y libssh libpsl libbrotli \
38
+ RUN microdnf install -y libssh libpsl libbrotli \
26
39
&& microdnf download curl libcurl \
27
40
&& rpm -Uvh --nodeps --replacefiles "*curl*$( uname -i ).rpm" \
28
- && microdnf remove -y libcurl-minimal curl-minimal
29
-
30
- RUN microdnf install -y --disableplugin=subscription-manager --setopt=install_weak_deps=0 nss_wrapper
31
- # Copy-pasted from https://www.mongodb.com/docs/manual/tutorial/install-mongodb-enterprise-on-red-hat-tarball/
32
- RUN microdnf install -y --disableplugin=subscription-manager \
33
- cyrus-sasl cyrus-sasl-gssapi cyrus-sasl-plain krb5-libs openldap openssl xz-libs
34
- # Dependencies for the Agent
35
- RUN microdnf install -y --disableplugin=subscription-manager --setopt=install_weak_deps=0 \
36
- net-snmp \
37
- net-snmp-agent-libs
38
- RUN microdnf install -y --disableplugin=subscription-manager \
39
- hostname tar gzip procps jq \
41
+ && microdnf remove -y libcurl-minimal curl-minimal \
42
+ && microdnf install -y --disableplugin=subscription-manager --setopt=install_weak_deps=0 nss_wrapper \
43
+ && microdnf install -y --disableplugin=subscription-manager \
44
+ cyrus-sasl cyrus-sasl-gssapi cyrus-sasl-plain krb5-libs openldap openssl xz-libs \
45
+ && microdnf install -y --disableplugin=subscription-manager --setopt=install_weak_deps=0 \
46
+ net-snmp \
47
+ net-snmp-agent-libs \
48
+ && microdnf install -y --disableplugin=subscription-manager \
49
+ hostname tar gzip procps jq \
40
50
&& microdnf upgrade -y \
41
- && rm -rf /var/lib/apt/lists/*
51
+ && microdnf clean all \
52
+ && mkdir -p /agent \
53
+ /var/lib/mongodb-mms-automation \
54
+ /var/log/mongodb-mms-automation \
55
+ /var/lib/automation/config \
56
+ && chmod -R +wr /var/log/mongodb-mms-automation/ \
57
+ && touch /var/log/mongodb-mms-automation/readiness.log \
58
+ && chmod ugo+rw /var/log/mongodb-mms-automation/readiness.log \
59
+ && chmod -R +r /var/lib/automation/config
42
60
61
+ COPY --from=base /data/LICENSE /licenses/LICENSE
43
62
44
- COPY --from=base /data/mongodb_tools_ubi.tgz /tools/mongodb_tools.tgz
45
- COPY --from=base /data/mongodb_agent_ubi.tgz /agent/mongodb_agent.tgz
46
-
47
- RUN tar xfz /tools/mongodb_tools.tgz
48
- RUN mv mongodb-database-tools-*/bin/* /tools
49
- RUN chmod +x /tools/*
50
- RUN rm /tools/mongodb_tools.tgz
51
- RUN rm -rf /mongodb-database-tools-*
52
-
53
- RUN tar xfz /agent/mongodb_agent.tgz
54
- RUN mv mongodb-mms-automation-agent-*/mongodb-mms-automation-agent /agent/mongodb-agent
55
- RUN chmod +x /agent/mongodb-agent
56
- RUN rm /agent/mongodb_agent.tgz
57
- RUN rm -rf mongodb-mms-automation-agent-*
63
+ COPY --from=builder /opt/scripts/* /opt/scripts/
64
+ COPY --from=builder /opt/mongodb-database-tools-*/bin /tools
65
+ COPY --from=builder /opt/mongodb-mms-automation-agent-*/mongodb-mms-automation-agent /agent/mongodb-agent
58
66
59
- RUN mkdir -p /var/lib/automation/config
60
- RUN chmod -R +r /var/lib/automation/config
67
+ RUN mkdir -p /var/lib/automation/config \
68
+ && chmod -R +r /var/lib/automation/config
61
69
62
70
USER 2000
63
71
0 commit comments