Run image as user unifi using USER directive and not sudo
| | |
| | | && rm -rf unifi_sysvinit_all.deb /var/lib/unifi/* \ |
| | | && groupadd -r -g 500 unifi \ |
| | | && useradd -r -d /usr/lib/unifi -u 500 -g 500 unifi \ |
| | | && chown -Rf unifi:unifi /usr/lib/unifi |
| | | && mkdir /usr/lib/unifi/data /var/lib/unifi \ |
| | | && chown -Rf unifi:unifi /usr/lib/unifi /var/lib/unifi |
| | | |
| | | EXPOSE 8080 8081 8443 8843 8880 |
| | | |
| | |
| | | WORKDIR /var/lib/unifi |
| | | COPY run.sh /run.sh |
| | | CMD /run.sh |
| | | |
| | | USER unifi |
| | |
| | | JAVA_OPTS="-Xmx1024m" |
| | | fi |
| | | |
| | | chown -Rf unifi:unifi /usr/lib/unifi/data |
| | | if [ `id -u` -eq 0 ]; then |
| | | chown -Rf unifi:unifi /usr/lib/unifi/data |
| | | |
| | | exec sudo -u unifi java $JAVA_OPTS -jar /usr/lib/unifi/lib/ace.jar start |
| | | exec sudo -u unifi java $JAVA_OPTS -jar /usr/lib/unifi/lib/ace.jar start |
| | | else |
| | | exec java $JAVA_OPTS -jar /usr/lib/unifi/lib/ace.jar start |
| | | fi |