Skip to content

Commit

Permalink
feat: multi-platform mongodb image (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
ed382 authored Aug 8, 2024
1 parent 835c5a2 commit 8e4bd34
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 12 deletions.
27 changes: 15 additions & 12 deletions bitnami/mongodb/7.0/debian-12/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
# Copyright Broadcom, Inc. All Rights Reserved.
# SPDX-License-Identifier: APACHE-2.0

FROM docker.io/bitnami/minideb:bookworm
FROM ubuntu:22.04

ARG TARGETARCH

LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \
org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \
org.opencontainers.image.created="2024-07-06T06:43:27Z" \
org.opencontainers.image.description="Application packaged by Broadcom, Inc." \
org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/mongodb/README.md" \
LABEL org.opencontainers.image.base.name="docker.io/library/ubuntu:22.04" \
org.opencontainers.image.description="Multi-platform image of Bitnami's MongoDB image" \
org.opencontainers.image.documentation="https://github.com/kubeshop/bitnami-containers/tree/main/bitnami/mongodb/README.md" \
org.opencontainers.image.licenses="Apache-2.0" \
org.opencontainers.image.ref.name="7.0.12-debian-12-r2" \
org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/mongodb" \
org.opencontainers.image.source="https://github.com/kubeshop/bitnami-containers/tree/main/bitnami/mongodb" \
org.opencontainers.image.title="mongodb" \
org.opencontainers.image.vendor="Broadcom, Inc." \
org.opencontainers.image.vendor="Kubeshop" \
org.opencontainers.image.version="7.0.12"

ENV HOME="/" \
Expand All @@ -31,8 +28,6 @@ RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \
"yq-4.44.2-2-linux-${OS_ARCH}-debian-12" \
"wait-for-port-1.0.8-2-linux-${OS_ARCH}-debian-12" \
"render-template-1.0.7-2-linux-${OS_ARCH}-debian-12" \
"mongodb-shell-2.2.10-0-linux-${OS_ARCH}-debian-12" \
"mongodb-7.0.12-0-linux-${OS_ARCH}-debian-12" \
) ; \
for COMPONENT in "${COMPONENTS[@]}"; do \
if [ ! -f "${COMPONENT}.tar.gz" ]; then \
Expand All @@ -43,13 +38,20 @@ RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \
tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \
rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \
done

RUN mkdir -p /opt/bitnami/mongodb

COPY rootfs /

RUN /opt/bitnami/scripts/mongodb/install_mongodb.sh
RUN /opt/bitnami/scripts/mongodb/install_mongosh.sh

RUN apt-get autoremove --purge -y curl && \
apt-get update && apt-get upgrade -y && \
apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives
RUN chmod g+rwX /opt/bitnami
RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true

COPY rootfs /
RUN /opt/bitnami/scripts/mongodb/postunpack.sh
ENV APP_VERSION="7.0.12" \
BITNAMI_APP_NAME="mongodb" \
Expand All @@ -60,3 +62,4 @@ EXPOSE 27017
USER 1001
ENTRYPOINT [ "/opt/bitnami/scripts/mongodb/entrypoint.sh" ]
CMD [ "/opt/bitnami/scripts/mongodb/run.sh" ]

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

# Mapping OS_ARCH to ALT_OS_ARCH
case $OS_ARCH in
arm64)
ALT_OS_ARCH="aarch64"
;;
amd64)
ALT_OS_ARCH="x86_64"
;;
*)
echo "Error: Unsupported OS_ARCH value '$OS_ARCH'"
exit 1
;;
esac

curl -SsLf "https://fastdl.mongodb.org/linux/mongodb-linux-${ALT_OS_ARCH}-ubuntu2204-7.0.12.tgz" -O
curl -SsLf "https://fastdl.mongodb.org/linux/mongodb-linux-${ALT_OS_ARCH}-ubuntu2204-7.0.12.tgz.sha256" -O
sha256sum -c "mongodb-linux-${ALT_OS_ARCH}-ubuntu2204-7.0.12.tgz.sha256"
tar -zxvf "mongodb-linux-${ALT_OS_ARCH}-ubuntu2204-7.0.12.tgz" -C /opt/bitnami/mongodb --strip-components=1 --no-same-owner
rm -rf mongodb-linux-"${ALT_OS_ARCH}"-ubuntu2204-7.0.12.tgz{,.sha256}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

# Mapping OS_ARCH to ALT_OS_ARCH
case $OS_ARCH in
arm64)
ALT_OS_ARCH="arm64"
;;
amd64)
ALT_OS_ARCH="x64"
;;
*)
echo "Error: Unsupported OS_ARCH value '$OS_ARCH'"
exit 1
;;
esac

curl -SsLf "https://downloads.mongodb.com/compass/mongosh-2.2.12-linux-${ALT_OS_ARCH}.tgz" -O
tar -zxvf "mongosh-2.2.12-linux-${ALT_OS_ARCH}.tgz" -C /opt/bitnami/mongodb --strip-components=1 --no-same-owner
rm -rf mongosh-2.2.12-linux-"${ALT_OS_ARCH}".tgz{,.sha256}

0 comments on commit 8e4bd34

Please sign in to comment.