1
+ ARG imagebase
2
+ FROM ${imagebase} as base
3
+
4
+ FROM registry.access.redhat.com/ubi8/ubi-minimal
5
+
6
+ ARG agent_version
7
+
8
+ LABEL name="MongoDB Agent" \
9
+ version="${agent_version}" \
10
+ summary="MongoDB Agent" \
11
+ description="MongoDB Agent" \
12
+ vendor="MongoDB" \
13
+ release="1" \
14
+
15
+
16
+ RUN microdnf install -y --disableplugin=subscription-manager --setopt=install_weak_deps=0 nss_wrapper
17
+ RUN microdnf install -y --disableplugin=subscription-manager curl \
18
+ hostname tar gzip procps\
19
+ && microdnf upgrade -y \
20
+ && rm -rf /var/lib/apt/lists/*
21
+
22
+ RUN mkdir -p /agent \
23
+ && mkdir -p /var/lib/mongodb-mms-automation \
24
+ && mkdir -p /var/log/mongodb-mms-automation/ \
25
+ && chmod -R +wr /var/log/mongodb-mms-automation/ \
26
+ # ensure that the agent user can write the logs in OpenShift
27
+ && touch /var/log/mongodb-mms-automation/readiness.log \
28
+ && chmod ugo+rw /var/log/mongodb-mms-automation/readiness.log
29
+
30
+
31
+ COPY --from=base /data/mongodb-agent.tar.gz /agent
32
+ COPY --from=base /data/mongodb-tools.tgz /agent
33
+ COPY --from=base /data/LICENSE /licenses/LICENSE
34
+
35
+ RUN tar xfz /agent/mongodb-agent.tar.gz \
36
+ && mv mongodb-mms-automation-agent-*/mongodb-mms-automation-agent /agent/mongodb-agent \
37
+ && chmod +x /agent/mongodb-agent \
38
+ && mkdir -p /var/lib/automation/config \
39
+ && chmod -R +r /var/lib/automation/config \
40
+ && rm /agent/mongodb-agent.tar.gz \
41
+ && rm -r mongodb-mms-automation-agent-*
42
+
43
+ RUN tar xfz /agent/mongodb-tools.tgz --directory /var/lib/mongodb-mms-automation/ && rm /agent/mongodb-tools.tgz
44
+
45
+ USER 2000
46
+ CMD ["/agent/mongodb-agent" , "-cluster=/var/lib/automation/config/automation-config.json" ]
0 commit comments