From b9668875ef07b0364abcabbc52be39fef57d5f03 Mon Sep 17 00:00:00 2001 From: Rostislav Dugin Date: Fri, 2 Jan 2026 12:21:02 +0300 Subject: [PATCH] FIX (mongodb): Fix MongoDB build for ARM --- Dockerfile | 18 +++++++++++------- assets/tools/README.md | 17 +++++++++++++++++ 2 files changed, 28 insertions(+), 7 deletions(-) create mode 100644 assets/tools/README.md diff --git a/Dockerfile b/Dockerfile index 31b6ec5..990ffbb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -172,19 +172,23 @@ RUN if [ "$TARGETARCH" = "amd64" ]; then \ # ========= Install MongoDB Database Tools ========= # Note: MongoDB Database Tools are backward compatible - single version supports all server versions (4.0-8.0) -# Use dpkg with apt-get -f install to handle dependencies +# Note: For ARM64, we use Ubuntu 22.04 package as MongoDB doesn't provide Debian 12 ARM64 packages RUN apt-get update && \ if [ "$TARGETARCH" = "amd64" ]; then \ wget -q https://fastdl.mongodb.org/tools/db/mongodb-database-tools-debian12-x86_64-100.10.0.deb -O /tmp/mongodb-database-tools.deb; \ elif [ "$TARGETARCH" = "arm64" ]; then \ - wget -q https://fastdl.mongodb.org/tools/db/mongodb-database-tools-debian12-aarch64-100.10.0.deb -O /tmp/mongodb-database-tools.deb; \ + wget -q https://fastdl.mongodb.org/tools/db/mongodb-database-tools-ubuntu2204-arm64-100.10.0.deb -O /tmp/mongodb-database-tools.deb; \ fi && \ - dpkg -i /tmp/mongodb-database-tools.deb || true && \ - apt-get install -f -y --no-install-recommends && \ - rm /tmp/mongodb-database-tools.deb && \ + dpkg -i /tmp/mongodb-database-tools.deb || apt-get install -f -y --no-install-recommends && \ + rm -f /tmp/mongodb-database-tools.deb && \ rm -rf /var/lib/apt/lists/* && \ - ln -sf /usr/bin/mongodump /usr/local/mongodb-database-tools/bin/mongodump && \ - ln -sf /usr/bin/mongorestore /usr/local/mongodb-database-tools/bin/mongorestore + mkdir -p /usr/local/mongodb-database-tools/bin && \ + if [ -f /usr/bin/mongodump ]; then \ + ln -sf /usr/bin/mongodump /usr/local/mongodb-database-tools/bin/mongodump; \ + fi && \ + if [ -f /usr/bin/mongorestore ]; then \ + ln -sf /usr/bin/mongorestore /usr/local/mongodb-database-tools/bin/mongorestore; \ + fi # Create postgres user and set up directories RUN useradd -m -s /bin/bash postgres || true && \ diff --git a/assets/tools/README.md b/assets/tools/README.md new file mode 100644 index 0000000..2d2f7a8 --- /dev/null +++ b/assets/tools/README.md @@ -0,0 +1,17 @@ +We keep binaries here to speed up CI \ CD tasks and building. + +Docker image needs: +- PostgreSQL client tools (versions 12-18) +- MySQL client tools (versions 5.7, 8.0, 8.4, 9) +- MariaDB client tools (versions 10.6, 12.1) +- MongoDB Database Tools (latest) + +For the most of tools, we need a couple of binaries for each version. However, if we download them on each run, it will download a couple of GBs each time. + +So, for speed up we keep only required executables (like pg_dump, mysqldump, mariadb-dump, mongodump, etc.). + +It takes: +- ~ 100MB for ARM +- ~ 100MB for x64 + +Instead of GBs. See Dockefile for usage details. \ No newline at end of file