From fa0908889c1d040b5734b46bd94aaf61a959e81e Mon Sep 17 00:00:00 2001 From: Jonathan GUILLOT Date: Mon, 23 Sep 2024 23:02:41 +0200 Subject: [PATCH] Mock java17-runtime package to avoid issues using APT Installing Openfire Debian package with `--force-depends` option results in issues using APT next. Trying to install a new package in a container will produce an error warning the user to use `apt --fix-broken install` to resolve the unmet dependencies issue. To avoid such an issue, build a fake java17-runtime package using `equivs` and install it. --- Dockerfile | 9 ++++++--- fake-java.equivs | 5 +++++ 2 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 fake-java.equivs diff --git a/Dockerfile b/Dockerfile index f0e7eda..22dc70c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,14 +5,17 @@ ENV OPENFIRE_VERSION=4.8.3 \ OPENFIRE_DATA_DIR=/var/lib/openfire \ OPENFIRE_LOG_DIR=/var/log/openfire +COPY fake-java.equivs /tmp/fake-java.equivs + RUN apt-get update \ - && DEBIAN_FRONTEND=noninteractive apt-get install -y sudo wget fontconfig libfreetype6 \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y sudo equivs wget fontconfig libfreetype6 \ + && cd /tmp && equivs-build /tmp/fake-java.equivs && dpkg -i /tmp/java17-runtime_17_all.deb \ && echo "Downloading openfire_${OPENFIRE_VERSION}_all.deb ..." \ && wget --no-verbose "http://download.igniterealtime.org/openfire/openfire_${OPENFIRE_VERSION}_all.deb" -O /tmp/openfire_${OPENFIRE_VERSION}_all.deb \ - && dpkg -i --force-depends /tmp/openfire_${OPENFIRE_VERSION}_all.deb \ + && dpkg -i /tmp/openfire_${OPENFIRE_VERSION}_all.deb \ && mv /var/lib/openfire/plugins/admin /usr/share/openfire/plugin-admin \ && ln -s /usr/local/openjdk-17/bin/java /usr/bin/java \ - && rm -rf /tmp/openfire_${OPENFIRE_VERSION}_all.deb \ + && rm -rf /tmp/*.deb /tmp/*.equivs \ && rm -rf /var/lib/apt/lists/* COPY entrypoint.sh /sbin/entrypoint.sh diff --git a/fake-java.equivs b/fake-java.equivs new file mode 100644 index 0000000..885d53e --- /dev/null +++ b/fake-java.equivs @@ -0,0 +1,5 @@ +Package: java17-runtime +Version: 17 +Architecture: all +Description: dummy java17-runtime package + A dummy package to avoid dpkg dependency issues.