-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContainerfile
More file actions
78 lines (67 loc) · 3.45 KB
/
Containerfile
File metadata and controls
78 lines (67 loc) · 3.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# --------------------------------------------------------------------------
# THIS FILE IS AUTOGENERATED - DO NOT EDIT MANUALLY
#
# Source: Containerfile.j2
# --------------------------------------------------------------------------
ARG BASE_VERSION=15
FROM ghcr.io/daemonless/base:${BASE_VERSION}
ARG FREEBSD_ARCH=amd64
ARG PACKAGES="openjdk17 mongodb70 snappyjava ca_root_nss"
ARG UPSTREAM_URL="https://fw-update.ui.com/api/firmware-latest?filter=eq~~product~~unifi-controller&filter=eq~~channel~~release"
ARG HEALTHCHECK_ENDPOINT="https://localhost:8443/status"
ENV HEALTHCHECK_URL="${HEALTHCHECK_ENDPOINT}"
LABEL org.opencontainers.image.title="UniFi Network" \
org.opencontainers.image.description="Ubiquiti UniFi Network Application for managing UniFi access points, switches, and gateways." \
org.opencontainers.image.source="https://github.com/daemonless/unifi" \
org.opencontainers.image.url="https://ui.com/" \
org.opencontainers.image.documentation="https://help.ui.com/" \
org.opencontainers.image.licenses="Proprietary" \
org.opencontainers.image.vendor="daemonless" \
org.opencontainers.image.authors="daemonless" \
io.daemonless.port="8443" \
io.daemonless.arch="${FREEBSD_ARCH}" \
org.freebsd.jail.allow.mlock="required" \
io.daemonless.category="Utilities" \
io.daemonless.upstream-url="${UPSTREAM_URL}" \
io.daemonless.upstream-jq='._embedded.firmware[0].version | sub("^v"; "") | split("+")[0]' \
io.daemonless.healthcheck-url="${HEALTHCHECK_ENDPOINT}" \
io.daemonless.packages="${PACKAGES}"
# Install dependencies (OpenJDK 17, MongoDB 7.0)
# snappyjava provides native FreeBSD snappy library (avoids bundled Linux lib)
RUN pkg update && \
pkg install -y \
${PACKAGES} && \
pkg clean -ay && \
rm -rf /var/cache/pkg/* /var/db/pkg/repos/*
# Download and install UniFi from Ubiquiti
# Single fetch - uses same URL/sed as labels for version, extracts download URL
RUN mkdir -p /usr/local/share/java/unifi && \
API_RESPONSE=$(fetch -qo - "${UPSTREAM_URL}") && \
UNIFI_VERSION=$(echo "$API_RESPONSE" | jq -r '._embedded.firmware[0].version | sub("^v"; "") | split("+")[0]') && \
UNIFI_URL=$(echo "$API_RESPONSE" | sed -n 's/.*"platform":"unix"[^}]*"href":"\([^"]*\)".*/\1\/data/p' | head -1) && \
echo "Downloading UniFi ${UNIFI_VERSION} from ${UNIFI_URL}..." && \
fetch -qo - "${UNIFI_URL}" | tar -xzf - -C /usr/local/share/java/unifi --strip-components=1 && \
echo "${UNIFI_VERSION}" > /usr/local/share/java/unifi/version.txt && \
mkdir -p /app && echo "${UNIFI_VERSION}" > /app/version
# Create config directory and configure UniFi to use system MongoDB
RUN mkdir -p /config /var/run/unifi && \
rm -rf /usr/local/share/java/unifi/data && \
ln -sf /config /usr/local/share/java/unifi/data && \
echo "db.mongo.local=false" > /config/system.properties && \
echo "db.mongo.uri=mongodb://127.0.0.1:27117/ace" >> /config/system.properties && \
chown -R bsd:bsd /config /var/run/unifi /usr/local/share/java/unifi
# Copy service definition and init scripts
COPY root/ /
# Make scripts executable
RUN chmod +x /etc/services.d/*/run /etc/cont-init.d/* /healthz 2>/dev/null || true
# Set up s6 service links for unifi and mongodb
# UniFi ports:
# 8443 - Web UI (HTTPS)
# 8080 - Device inform
# 8843 - Guest portal HTTPS
# 8880 - Guest portal HTTP
# 6789 - Mobile throughput test
# 3478/udp - STUN
# 10001/udp - Device discovery
EXPOSE 8443 8080 8843 8880 6789 3478 10001
VOLUME /config