FROM alpine:edge LABEL maintainer="Mike Crute " # TODO: Move all the unpacking stuff to the Makefile ARG deb_version ARG checksum ADD log4j.properties /tmp/ RUN set -euxo pipefail; \ # Validate required arguments were passed test -z "${deb_version}" && { echo -e "\033[31mMissing build parameter 'deb_version'\033[39m"; exit 1; }; \ test -z "${checksum}" && { echo -e "\033[31mMissing build parameter 'checksum'\033[39m"; exit 1; }; \ \ # Install build and run dependencies apk add --no-cache --virtual .build-deps \ binutils \ ca-certificates \ curl \ && apk add --no-cache \ dumb-init \ java-snappy \ libcap \ nss \ openjdk17-jre-headless \ su-exec \ \ # Fetch the Unifi package and validate the checksum before unpacking && cd /tmp \ && curl -sO "https://dl.ui.com/unifi/${deb_version}/unifi_sysvinit_all.deb" \ && echo "${checksum} *unifi_sysvinit_all.deb" > checksums.txt \ && sha256sum -sc checksums.txt \ \ # Unpack the debian package and "install" it && ar x unifi_sysvinit_all.deb \ && tar -xJf data.tar.xz \ && rm usr/lib/unifi/bin/unifi.init \ && mv usr/lib/unifi /usr/lib \ \ # Create directories and link everything together && mkdir -p /var/lib/unifi /var/log/unifi /var/run/unifi \ && ln -sf /usr/bin/mongod /usr/lib/unifi/bin/mongod \ && ln -sf /var/lib/unifi /usr/lib/unifi/data \ && ln -sf /var/log/unifi /usr/lib/unifi/logs \ && ln -sf /var/run/unifi /usr/lib/unifi/run \ \ # Install our customizations && mv /tmp/log4j.properties /usr/lib/unifi \ \ # Cleanup && apk del .build-deps \ && rm -rf /tmp/* ADD unifi-setup.sh / ADD simplevisor.json / ADD simplevisor / STOPSIGNAL SIGTERM ENTRYPOINT [ "/simplevisor" ]