FROM alpine:edge LABEL maintainer="Mike Crute " ARG deb_location ARG checksum_line ADD log4j.properties /tmp/ RUN set -euxo pipefail; \ # Validate required arguments were passed test -z "${deb_location}" && { echo -e "\033[31mMissing build parameter 'deb_location'\033[39m"; exit 1; }; \ test -z "${checksum_line}" && { echo -e "\033[31mMissing build parameter 'checksum_line'\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 \ # Alpine moved this to non-free which doesn't get published so we'll have to # build our own repo for mongodb if needed. This should not be needed for # Mike's config since he uses out-of-container mongodb. # mongodb \ mongodb-tools \ nss \ openjdk8-jre-base \ su-exec \ \ # Fetch the Unifi package and validate the checksum before unpacking && cd /tmp \ && curl -sO "$deb_location" \ && echo "${checksum_line}" > 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 entrypoint.sh / STOPSIGNAL SIGTERM ENTRYPOINT [ "/entrypoint.sh" ]