Dockerfile for UniFi Controller

35 || 0  || 2018-08-04 08:50:41 || root || || Dockerfile

Dockerfile for building UniFi Controller image on Raspberry Pi

Check the following document with instructions how to build an image and run a container: https://snippets.yoctocloud.cc/snippets/f7a6cbc1102a4ab581143f5af7bf626e/

# Version 5.8.24
FROM resin/rpi-raspbian:stretch

# Update OS
RUN apt-get update \
    && apt-get upgrade -y \
    && apt-get clean \
    && apt-get autoclean \
    && apt-get autoremove \
    && rm -fr /var/lib/apt/lists/* /tmp/* /var/tmp/*

# Install Oracle Java8 from PPA
RUN echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" > /etc/apt/sources.list.d/webupd8team-java.list \
    && apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886 \
    && echo "oracle-java8-installer shared/accepted-oracle-license-v1-1 select true" | debconf-set-selections \
    && apt-get update \
    && apt-get install -qy --no-install-recommends oracle-java8-installer \
    && apt-get clean \
    && apt-get autoclean \
    && apt-get autoremove \
    && rm -fr /var/lib/apt/lists/* /tmp/* /var/tmp/* /var/cache/apt/archives/*

# UniFi and Java environment variables
ENV UNIFI_URL=https://dl.ubnt.com/unifi/5.8.24/unifi_sysvinit_all.deb \
    JAVA_HOME=/usr/lib/jvm/java-8-oracle \
    JVM_MAX_HEAP_SIZE=256M

# Install MongoDB and UniFi
RUN echo "deb http://www.ubnt.com/downloads/unifi/debian unifi5 ubiquiti" > /etc/apt/sources.list.d/20ubiquiti.list \
    && apt-key adv --keyserver keyserver.ubuntu.com --recv C0A52C50 \
    && apt-get update \
    && apt-get install -qy --no-install-recommends curl gdebi-core \
    && curl -o ./unifi.deb ${UNIFI_URL} \
    && yes | gdebi ./unifi.deb \
    && rm -f ./unifi.deb \
    && rm -rf /usr/lib/unifi/lib/native/Linux/armhf/libubnt_webrtc_jni.so \
    && apt-get clean \
    && apt-get autoclean \
    && apt-get autoremove \
    && rm -fr /var/lib/apt/lists/* /tmp/* /var/tmp/* /var/cache/apt/archives/*

ENTRYPOINT []

# UniFi ports
EXPOSE 8080/tcp 8443/tcp 6789/tcp 3478/udp 10001/udp

WORKDIR /usr/lib/unifi

CMD ["/usr/lib/jvm/java-8-oracle/jre/bin/java", "-Xmx256M", "-jar", "/usr/lib/unifi/lib/ace.jar", "start"]