Skip to content

Commit 7b8cc91

Browse files
authored
Use the right public dockerfiles for the latest agent images (#459)
# Summary When preparing for the 1.4.0 release I copied the wrong agent dockerfiles in the public folder, these are the updated multi arch ones.
1 parent 5096225 commit 7b8cc91

File tree

2 files changed

+152
-51
lines changed

2 files changed

+152
-51
lines changed
Lines changed: 76 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,60 @@
1-
ARG imagebase
2-
FROM ${imagebase} as base
1+
FROM --platform=${BUILDPLATFORM} registry.access.redhat.com/ubi9/ubi-minimal AS tools_downloader
32

4-
FROM registry.access.redhat.com/ubi9/ubi-minimal
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
59

6-
ARG version
10+
RUN microdnf -y update --nodocs \
11+
&& microdnf -y install --nodocs tar gzip \
12+
&& microdnf clean all
713

8-
LABEL name="MongoDB Agent" \
9-
version="${version}" \
10-
summary="MongoDB Agent" \
11-
description="MongoDB Agent" \
12-
vendor="MongoDB" \
13-
release="1" \
14-
maintainer="[email protected]"
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
1558

1659
# Replace libcurl-minimal and curl-minimal with the full versions
1760
# https://bugzilla.redhat.com/show_bug.cgi?id=1994521
@@ -41,20 +84,30 @@ RUN mkdir -p /agent \
4184
&& touch /var/log/mongodb-mms-automation/readiness.log \
4285
&& chmod ugo+rw /var/log/mongodb-mms-automation/readiness.log
4386

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
4493

45-
COPY --from=base /data/mongodb-agent.tar.gz /agent
46-
COPY --from=base /data/mongodb-tools.tgz /agent
47-
COPY --from=base /data/LICENSE /licenses/LICENSE
94+
RUN mkdir -p /var/lib/automation/config \
95+
&& chmod -R +r /var/lib/automation/config
4896

49-
RUN tar xfz /agent/mongodb-agent.tar.gz \
50-
&& mv mongodb-mms-automation-agent-*/mongodb-mms-automation-agent /agent/mongodb-agent \
51-
&& chmod +x /agent/mongodb-agent \
52-
&& mkdir -p /var/lib/automation/config \
53-
&& chmod -R +r /var/lib/automation/config \
54-
&& rm /agent/mongodb-agent.tar.gz \
55-
&& rm -r mongodb-mms-automation-agent-*
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
56103

57-
RUN tar xfz /agent/mongodb-tools.tgz --directory /var/lib/mongodb-mms-automation/ && rm /agent/mongodb-tools.tgz
104+
LABEL name="MongoDB Agent" \
105+
version="${version}" \
106+
summary="MongoDB Agent" \
107+
description="MongoDB Agent" \
108+
vendor="MongoDB" \
109+
release="1" \
110+
maintainer="[email protected]"
58111

59112
USER 2000
60-
CMD ["/agent/mongodb-agent", "-cluster=/var/lib/automation/config/automation-config.json"]
113+
CMD ["/agent/mongodb-agent", "-cluster=/var/lib/automation/config/automation-config.json"]
Lines changed: 76 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,60 @@
1-
ARG imagebase
2-
FROM ${imagebase} as base
1+
FROM --platform=${BUILDPLATFORM} registry.access.redhat.com/ubi9/ubi-minimal AS tools_downloader
32

4-
FROM registry.access.redhat.com/ubi9/ubi-minimal
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
59

6-
ARG version
10+
RUN microdnf -y update --nodocs \
11+
&& microdnf -y install --nodocs tar gzip \
12+
&& microdnf clean all
713

8-
LABEL name="MongoDB Agent" \
9-
version="${version}" \
10-
summary="MongoDB Agent" \
11-
description="MongoDB Agent" \
12-
vendor="MongoDB" \
13-
release="1" \
14-
maintainer="[email protected]"
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
1558

1659
# Replace libcurl-minimal and curl-minimal with the full versions
1760
# https://bugzilla.redhat.com/show_bug.cgi?id=1994521
@@ -41,25 +84,30 @@ RUN mkdir -p /agent \
4184
&& touch /var/log/mongodb-mms-automation/readiness.log \
4285
&& chmod ugo+rw /var/log/mongodb-mms-automation/readiness.log
4386

44-
COPY --from=base /data/mongodb-agent.tar.gz /agent
45-
COPY --from=base /data/mongodb-tools.tgz /agent
46-
COPY --from=base /data/LICENSE /licenses/LICENSE
47-
4887
# Copy scripts to a safe location that won't be overwritten by volume mount
49-
COPY --from=base /opt/scripts/agent-launcher-shim.sh /usr/local/bin/agent-launcher-shim.sh
50-
COPY --from=base /opt/scripts/setup-agent-files.sh /usr/local/bin/setup-agent-files.sh
51-
COPY --from=base /opt/scripts/dummy-probe.sh /usr/local/bin/dummy-probe.sh
52-
COPY --from=base /opt/scripts/dummy-readinessprobe.sh /usr/local/bin/dummy-readinessprobe
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
5393

54-
RUN tar xfz /agent/mongodb-agent.tar.gz \
55-
&& mv mongodb-mms-automation-agent-*/mongodb-mms-automation-agent /agent/mongodb-agent \
56-
&& chmod +x /agent/mongodb-agent \
57-
&& mkdir -p /var/lib/automation/config \
58-
&& chmod -R +r /var/lib/automation/config \
59-
&& rm /agent/mongodb-agent.tar.gz \
60-
&& rm -r mongodb-mms-automation-agent-*
94+
RUN mkdir -p /var/lib/automation/config \
95+
&& chmod -R +r /var/lib/automation/config
96+
97+
RUN mkdir -p /tools /agent
6198

62-
RUN tar xfz /agent/mongodb-tools.tgz --directory /var/lib/mongodb-mms-automation/ && rm /agent/mongodb-tools.tgz
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="[email protected]"
63111

64112
USER 2000
65-
CMD ["/agent/mongodb-agent", "-cluster=/var/lib/automation/config/automation-config.json"]
113+
CMD ["/agent/mongodb-agent", "-cluster=/var/lib/automation/config/automation-config.json"]

0 commit comments

Comments
 (0)