Skip to content

Commit

Permalink
Adding 8.4.59
Browse files Browse the repository at this point in the history
  • Loading branch information
ryansch committed Sep 1, 2024
1 parent 9dadcb6 commit 71438c2
Show file tree
Hide file tree
Showing 7 changed files with 359 additions and 2 deletions.
127 changes: 127 additions & 0 deletions 8.4/Dockerfile.amd64
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
# syntax=docker/dockerfile:1
# hadolint global ignore=DL3008
# hadolint global ignore=DL3003
FROM ubuntu:noble as tini
ENV TINI_VERSION v0.19.0
ENV TINI_ARCH -amd64

SHELL ["/bin/bash", "-o", "pipefail", "-c"]
ENV DEBIAN_FRONTEND=noninteractive

RUN set -eux; \
\
apt-get update -y; \
apt-get install -y --no-install-recommends \
wget \
ca-certificates \
gnupg \
dirmngr \
apt-transport-https \
; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*

RUN set -eux; \
\
mkdir -p /tmp/build; \
cd /tmp/build; \
\
wget --progress=dot:giga -O tini https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-static${TINI_ARCH}; \
wget --progress=dot:giga -O tini.asc https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-static${TINI_ARCH}.asc; \
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 595E85A6B1B4779EA4DAAEC70B588DFF0527A9B7; \
gpg --batch --verify tini.asc tini; \
cp tini /sbin/; \
chmod +x /sbin/tini; \
\
cd /tmp; \
rm -rf /tmp/build; \
rm -rf /root/.gnupg

FROM ubuntu:noble
LABEL maintainer="Ryan Schlesinger <ryan@ryanschlesinger.com>"

SHELL ["/bin/bash", "-o", "pipefail", "-c"]
ENV DEBIAN_FRONTEND=noninteractive

COPY --from=tini /sbin/tini /sbin/tini

# hadolint ignore=SC1083
RUN set -eux; \
\
apt-get update -y; \
apt-get install -y --no-install-recommends \
wget \
curl \
ca-certificates \
gnupg \
dirmngr \
apt-transport-https \
openjdk-11-jre-headless \
; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*

# Adapted from: https://get.glennr.nl/unifi/install/unifi-8.1.127.sh
RUN set -eux; \
\
libssl_temp="$(mktemp --tmpdir=/tmp libssl1.1.1_XXXXX.deb)"; \
wget -qO "$libssl_temp" 'http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.23_amd64.deb'; \
dpkg -i "$libssl_temp"; \
rm --force "$libssl_temp" 2> /dev/null; \
\
curl -fsSL https://www.mongodb.org/static/pgp/server-4.4.asc | \
gpg -o /usr/share/keyrings/mongodb-server-4.4.gpg \
--dearmor ; \
echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-4.4.gpg ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-4.4.list; \
apt-get update; \
apt-get -y --no-install-recommends -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' install \
mongodb-org=4.4.18 \
mongodb-org-server=4.4.18 \
mongodb-org-mongos=4.4.18 \
mongodb-org-tools=4.4.18 \
mongodb-org-shell=4.4.18 \
; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*

# Install any version from deb download
ENV UNIFI_VERSION 8.4.59-y2b2oj1o96
ENV UNIFI_DOCKER_VERSION 8.4.59
ENV UNIFI_SHA256 57046f53e20726ceae4e1756174b8eab1cf871e801ca463307f7c3d3f0063da3

RUN set -eux; \
\
mkdir -p /usr/share/man/man1; \
mkdir -p /tmp/build; \
cd /tmp/build; \
\
wget -qO /etc/apt/trusted.gpg.d/unifi-repo.gpg https://dl.ui.com/unifi/unifi-repo.gpg; \
wget -qO unifi_sysvinit_all.deb https://dl.ui.com/unifi/${UNIFI_VERSION}/unifi_sysvinit_all.deb; \
echo "${UNIFI_SHA256} unifi_sysvinit_all.deb" | sha256sum --check; \
apt-get update -y; \
apt-get install -y --no-install-recommends \
./unifi_sysvinit_all.deb \
procps \
; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*; \
rm -rf /tmp/build

COPY script.sed /tmp/script.sed
RUN set -eux; \
\
cd /usr/sbin; \
sed -E -i.bak -f /tmp/script.sed unifi-network-service-helper; \
rm -f /tmp/script.sed

EXPOSE 8080/tcp 8443/tcp 8843/tcp 8880/tcp 3478/udp

WORKDIR /usr/lib/unifi

COPY entrypoint.sh /docker-entrypoint.sh
ENTRYPOINT ["/sbin/tini", "-g", "--", "/docker-entrypoint.sh"]
CMD ["start"]

COPY healthcheck.sh /healthcheck.sh
HEALTHCHECK --start-period=300s --timeout=30s --interval=30s \
CMD /healthcheck.sh || exit 1
127 changes: 127 additions & 0 deletions 8.4/Dockerfile.arm64v8
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
# syntax=docker/dockerfile:1
# hadolint global ignore=DL3008
# hadolint global ignore=DL3003
FROM arm64v8/ubuntu:noble as tini
ENV TINI_VERSION v0.19.0
ENV TINI_ARCH -arm64

SHELL ["/bin/bash", "-o", "pipefail", "-c"]
ENV DEBIAN_FRONTEND=noninteractive

RUN set -eux; \
\
apt-get update -y; \
apt-get install -y --no-install-recommends \
wget \
ca-certificates \
gnupg \
dirmngr \
apt-transport-https \
; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*

RUN set -eux; \
\
mkdir -p /tmp/build; \
cd /tmp/build; \
\
wget --progress=dot:giga -O tini https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-static${TINI_ARCH}; \
wget --progress=dot:giga -O tini.asc https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-static${TINI_ARCH}.asc; \
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 595E85A6B1B4779EA4DAAEC70B588DFF0527A9B7; \
gpg --batch --verify tini.asc tini; \
cp tini /sbin/; \
chmod +x /sbin/tini; \
\
cd /tmp; \
rm -rf /tmp/build; \
rm -rf /root/.gnupg

FROM arm64v8/ubuntu:noble
LABEL maintainer="Ryan Schlesinger <ryan@ryanschlesinger.com>"

SHELL ["/bin/bash", "-o", "pipefail", "-c"]
ENV DEBIAN_FRONTEND=noninteractive

COPY --from=tini /sbin/tini /sbin/tini

# hadolint ignore=SC1083
RUN set -eux; \
\
apt-get update -y; \
apt-get install -y --no-install-recommends \
wget \
curl \
ca-certificates \
gnupg \
dirmngr \
apt-transport-https \
openjdk-11-jre-headless \
; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*

# Adapted from: https://get.glennr.nl/unifi/install/unifi-8.1.127.sh
RUN set -eux; \
\
libssl_temp="$(mktemp --tmpdir=/tmp libssl1.1.1_XXXXX.deb)"; \
wget -qO "$libssl_temp" 'http://ports.ubuntu.com/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_arm64.deb'; \
dpkg -i "$libssl_temp"; \
rm --force "$libssl_temp" 2> /dev/null; \
\
curl -fsSL https://www.mongodb.org/static/pgp/server-4.4.asc | \
gpg -o /usr/share/keyrings/mongodb-server-4.4.gpg \
--dearmor ; \
echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-4.4.gpg ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-4.4.list; \
apt-get update; \
apt-get -y --no-install-recommends -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' install \
mongodb-org=4.4.18 \
mongodb-org-server=4.4.18 \
mongodb-org-mongos=4.4.18 \
mongodb-org-tools=4.4.18 \
mongodb-org-shell=4.4.18 \
; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*

# Install any version from deb download
ENV UNIFI_VERSION 8.4.59-y2b2oj1o96
ENV UNIFI_DOCKER_VERSION 8.4.59
ENV UNIFI_SHA256 57046f53e20726ceae4e1756174b8eab1cf871e801ca463307f7c3d3f0063da3

RUN set -eux; \
\
mkdir -p /usr/share/man/man1; \
mkdir -p /tmp/build; \
cd /tmp/build; \
\
wget -qO /etc/apt/trusted.gpg.d/unifi-repo.gpg https://dl.ui.com/unifi/unifi-repo.gpg; \
wget -qO unifi_sysvinit_all.deb https://dl.ui.com/unifi/${UNIFI_VERSION}/unifi_sysvinit_all.deb; \
echo "${UNIFI_SHA256} unifi_sysvinit_all.deb" | sha256sum --check; \
apt-get update -y; \
apt-get install -y --no-install-recommends \
./unifi_sysvinit_all.deb \
procps \
; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*; \
rm -rf /tmp/build

COPY script.sed /tmp/script.sed
RUN set -eux; \
\
cd /usr/sbin; \
sed -E -i.bak -f /tmp/script.sed unifi-network-service-helper; \
rm -f /tmp/script.sed

EXPOSE 8080/tcp 8443/tcp 8843/tcp 8880/tcp 3478/udp

WORKDIR /usr/lib/unifi

COPY entrypoint.sh /docker-entrypoint.sh
ENTRYPOINT ["/sbin/tini", "-g", "--", "/docker-entrypoint.sh"]
CMD ["start"]

COPY healthcheck.sh /healthcheck.sh
HEALTHCHECK --start-period=300s --timeout=30s --interval=30s \
CMD /healthcheck.sh || exit 1
79 changes: 79 additions & 0 deletions 8.4/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#!/bin/bash

set -euo pipefail

function get_unifi_property() {
if [ -f /var/lib/unifi/system.properties ]; then
property_name=$1
cut -d "=" -f2 <<<$(grep "^[^#;]" /var/lib/unifi/system.properties | grep "$property_name")
fi
}

function verify_unifi_port() {
local property_name=$1
local required_port=$2

local actual_port
actual_port=$(get_unifi_property "$property_name")

if [ "${actual_port:-$required_port}" != "$required_port" ]; then
echo
echo "Unifi system property '$property_name' is set to something other than '$required_port'!"
echo "This docker image does not support changing the default ports inside the container."
echo "If you want a different port, use docker port mapping to do it."
exit 1
fi
}

if [ -d /var/lib/unifi/db ]; then
pushd /var/lib/unifi/db >/dev/null

if [ -f /var/lib/unifi/db/WiredTiger.turtle ]; then
major_version=$(cat /var/lib/unifi/db/WiredTiger.turtle | grep -E 'major=.+,minor=.+,patch=.+' | cut -d ',' -f 1 | cut -d '=' -f 2)

if (("${major_version}" < 10)); then
echo "Older mongodb files detected!"
echo "We've been forced to upgrade mongodb to version 4.4."
echo "You must back up your unifi network application, remove all docker volumes,"
echo "start up unifi, and restore from backup during setup."
exit 1
fi
fi

popd >/dev/null
fi

# Setting defaults
UNIFI_CORE_ENABLED=false
UNIFI_MONGODB_SERVICE_ENABLED=false
UNIFI_JVM_OPTS="-Xmx1024M -XX:+UseParallelGC"
: ${UNIFI_JVM_EXTRA_OPTS:=${JAVA_OPTS:-}}

/usr/sbin/unifi-network-service-helper init

echo "Loading /usr/lib/unifi/data/system_env"
source /usr/lib/unifi/data/system_env

verify_unifi_port 'unifi.http.port' '8080'
verify_unifi_port 'unifi.https.port' '8443'
verify_unifi_port 'portal.http.port' '8880'
verify_unifi_port 'portal.https.port' '8843'
verify_unifi_port 'unifi.stun.port' '3478'

exec /usr/bin/java \
-Dfile.encoding=UTF-8 \
-Djava.awt.headless=true \
-Dapple.awt.UIElement=true \
-Dunifi.core.enabled=${UNIFI_CORE_ENABLED} \
-Dunifi.mongodb.service.enabled=${UNIFI_MONGODB_SERVICE_ENABLED} \
$UNIFI_JVM_OPTS \
-XX:+ExitOnOutOfMemoryError \
-XX:+CrashOnOutOfMemoryError \
-XX:ErrorFile=/usr/lib/unifi/logs/hs_err_pid%p.log \
-Xlog:gc:logs/gc.log:time:filecount=2,filesize=5M \
--add-opens java.base/java.lang=ALL-UNNAMED \
--add-opens java.base/java.time=ALL-UNNAMED \
--add-opens java.base/sun.security.util=ALL-UNNAMED \
--add-opens java.base/java.io=ALL-UNNAMED \
--add-opens java.rmi/sun.rmi.transport=ALL-UNNAMED \
-jar /usr/lib/unifi/lib/ace.jar start
6 changes: 6 additions & 0 deletions 8.4/healthcheck.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

set -euo pipefail

STATUS_URL="https://localhost:8443/status"
curl -s --fail --insecure --connect-timeout 1 --max-time 5 "$STATUS_URL"
16 changes: 16 additions & 0 deletions 8.4/manifest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
image: ryansch/unifi-rpi:8.4.59
tags:
- 8.4
- 8
- latest
manifests:
-
image: ryansch/unifi-rpi:8.4.59-amd64
platform:
architecture: amd64
os: linux
-
image: ryansch/unifi-rpi:8.4.59-arm64v8
platform:
architecture: arm64
os: linux
2 changes: 2 additions & 0 deletions 8.4/script.sed
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/logger/c\
echo "${@}"
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ Docker images for running Ubiquiti's [UniFi Controller software](https://www.ubn

# Supported tags and respective `Dockerfile` directory links

- [`8.1.127`, `8.1` (v8.1.127/8.1)](https://github.com/ryansch/docker-unifi-rpi/tree/v8.1.127/8.1)
- [`8.2.93`, `8.2` (v8.2.93/8.2)](https://github.com/ryansch/docker-unifi-rpi/tree/v8.2.93/8.2)
- [`8.3.32`, `8.3`, `8`, `latest` (v8.3.32/8.3)](https://github.com/ryansch/docker-unifi-rpi/tree/v8.3.32/8.3)
- [`8.3.32`, `8.3` (v8.3.32/8.3)](https://github.com/ryansch/docker-unifi-rpi/tree/v8.3.32/8.3)
- [`8.4.59`, `8.4`, `8`, `latest` (v8.4.59/8.4)](https://github.com/ryansch/docker-unifi-rpi/tree/v8.4.59/8.4)

## Versions

Expand Down

0 comments on commit 71438c2

Please sign in to comment.