From 9c8ec6f9188ed42d255fba798d02ef15d74cfe49 Mon Sep 17 00:00:00 2001 From: Christophe Fergeau Date: Wed, 17 Jan 2024 21:52:46 +0100 Subject: [PATCH] Install mongodb 4.4 While there are no mongodb-org-server 4.4 builds available in mongodb's ubuntu 22.04 repos, there are such builds in the 20.04 repos. We need to manually install the older libssl version mongodb-server requires. This reuses what is done in glennr unifi install scripts. Signed-off-by: Christophe Fergeau --- unifi/Dockerfile | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/unifi/Dockerfile b/unifi/Dockerfile index 0d58338..a842550 100755 --- a/unifi/Dockerfile +++ b/unifi/Dockerfile @@ -2,10 +2,19 @@ ARG BUILD_FROM=ghcr.io/hassio-addons/ubuntu-base:9.0.3 # hadolint ignore=DL3006 FROM ${BUILD_FROM} +ARG BUILD_ARCH=amd64 + # Set shell SHELL ["/bin/bash", "-o", "pipefail", "-c"] # Setup base system + +# mongodb-org-server is installed from the community servers as it's gone from +# repositories for newer ubuntu versions. +# +# Beware of the licence change, previously the addon used mongodb version 3.6.9 +# released under the AGPL, while 4.0.3 and newer are released under the non-free SSPL +# https://en.wikipedia.org/wiki/MongoDB#Licensing RUN \ apt-get update \ && apt-get upgrade -y \ @@ -14,14 +23,19 @@ RUN \ logrotate=3.19.0-1ubuntu1.1 \ openjdk-17-jre-headless=17* \ \ - && curl -J -L -o /usr/share/keyrings/mongodb-server-7.0.gpg https://pgp.mongodb.com/server-7.0.pub \ - && echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 multiverse" >/etc/apt/sources.list.d/mongodb-org-7.0.list \ + && pkgname=libssl1.1_1.1.1f-1ubuntu2.22 \ + && if [ "${BUILD_ARCH}" = "aarch64" ]; then pkgurl="http://ports.ubuntu.com/pool/main/o/openssl/${pkgname}_arm64.deb"; fi \ + && if [ "${BUILD_ARCH}" = "amd64" ]; then pkgurl="http://security.ubuntu.com/ubuntu/pool/main/o/openssl/${pkgname}_amd64.deb"; fi \ + && curl -L -o /tmp/libssl.deb "${pkgurl}" \ + && dpkg --install "/tmp/libssl.deb" \ + && curl -J -L -o /etc/apt/keyrings/mongodb-server-4.4.gpg https://pgp.mongodb.com/server-4.4.pub \ + && echo "deb [ arch=amd64,arm64 signed-by=/etc/apt/keyrings/mongodb-server-4.4.gpg ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" >/etc/apt/sources.list.d/mongodb-org-4.4.list \ && apt-get update \ - && apt-get install -y --no-install-recommends mongodb-org-server=7.0.7 \ + && apt-get install -y --no-install-recommends mongodb-org-server=4.4.29 \ && curl -J -L -o /tmp/unifi.deb \ "https://dl.ui.com/unifi/8.0.28/unifi_sysvinit_all.deb" \ \ - && dpkg --install --ignore-depends=mongodb-org-server /tmp/unifi.deb \ + && dpkg --install /tmp/unifi.deb \ && apt-get clean \ && rm -fr \ /tmp/* \ @@ -38,7 +52,6 @@ HEALTHCHECK --start-period=5m \ CMD curl --insecure --fail https://localhost:8443 || exit 1 # Build arguments -ARG BUILD_ARCH ARG BUILD_DATE ARG BUILD_DESCRIPTION ARG BUILD_NAME