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+ maintainer="support@mongodb.com"
15+
16+ RUN microdnf install -y --disableplugin=subscription-manager curl \
17+ hostname nss_wrapper tar gzip procps\
18+ && microdnf upgrade -y \
19+ && rm -rf /var/lib/apt/lists/*
20+
21+ RUN mkdir -p /agent \
22+ && mkdir -p /var/lib/mongodb-mms-automation \
23+ && mkdir -p /var/log/mongodb-mms-automation/ \
24+ && chmod -R +wr /var/log/mongodb-mms-automation/ \
25+ # ensure that the agent user can write the logs in OpenShift
26+ && touch /var/log/mongodb-mms-automation/readiness.log \
27+ && chmod ugo+rw /var/log/mongodb-mms-automation/readiness.log
28+
29+
30+ COPY --from=base /data/mongodb-agent.tar.gz /agent
31+ COPY --from=base /data/mongodb-tools.tgz /agent
32+ COPY --from=base /data/LICENSE /licenses/LICENSE
33+
34+ RUN tar xfz /agent/mongodb-agent.tar.gz \
35+ && mv mongodb-mms-automation-agent-*/mongodb-mms-automation-agent /agent/mongodb-agent \
36+ && chmod +x /agent/mongodb-agent \
37+ && mkdir -p /var/lib/automation/config \
38+ && chmod -R +r /var/lib/automation/config \
39+ && rm /agent/mongodb-agent.tar.gz \
40+ && rm -r mongodb-mms-automation-agent-*
41+
42+ RUN tar xfz /agent/mongodb-tools.tgz --directory /var/lib/mongodb-mms-automation/ && rm /agent/mongodb-tools.tgz
43+
44+ USER 2000
45+ CMD ["/agent/mongodb-agent" , "-cluster=/var/lib/automation/config/automation-config.json" ]
0 commit comments