-
Notifications
You must be signed in to change notification settings - Fork 1
/
amd64.dockerfile
87 lines (73 loc) · 2.27 KB
/
amd64.dockerfile
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
79
80
81
82
83
84
85
86
87
# :: Util
FROM alpine as util
RUN set -ex; \
apk add --no-cache \
git; \
git clone https://github.com/11notes/util.git;
# :: Header
FROM ubuntu:20.04
COPY --from=util /util/linux/shell/elevenLogJSON /usr/local/bin
ARG APP_RC="-rj47uhde42"
ARG DEBIAN_FRONTEND=noninteractive
ENV APP_NAME="unifi"
ENV APP_VERSION=8.6.3
ENV APP_ROOT=/unifi
# :: Run
USER root
# :: update image
RUN set -ex; \
apt update -y; \
apt upgrade -y;
# :: prepare image
RUN set -ex; \
mkdir -p ${APP_ROOT};
# https://community.ui.com/RELEASES UniFi Network Application
ADD https://dl.ui.com/unifi/${APP_VERSION}${APP_RC}/unifi_sysvinit_all.deb /tmp/unifi.deb
RUN set -ex; \
apt install -y \
mongodb=1:3.6.9+really3.6.8+90~g8e540c0b6d-0ubuntu5 \
openjdk-17-jre-headless \
binutils \
jsvc \
curl \
libcap2 \
liblog4j2-java \
tzdata \
gosu \
logrotate;
RUN set -ex; \
dpkg -i /tmp/unifi.deb; \
ln -s /var/lib/unifi ${APP_ROOT}/var; \
ln -s /var/log/unifi ${APP_ROOT}/log; \
mkdir -p ${APP_ROOT}/var/sites/default;
# :: copy root filesystem changes and add execution rights to init scripts
COPY ./rootfs /
RUN set -ex; \
chmod +x -R /usr/local/bin
# :: set uid/gid to 1000:1000 for existing user
RUN set -ex; \
NOROOT_USER="unifi" \
NOROOT_UID="$(id -u ${NOROOT_USER})"; \
NOROOT_GID="$(id -g ${NOROOT_USER})"; \
find / -not -path "/proc/*" -user ${NOROOT_UID} -exec chown -h -R 1000:1000 {} \;;\
find / -not -path "/proc/*" -group ${NOROOT_GID} -exec chown -h -R 1000:1000 {} \;; \
usermod -u 1000 ${NOROOT_USER}; \
groupmod -g 1000 ${NOROOT_USER}; \
usermod -l docker ${NOROOT_USER}; \
groupmod -n docker ${NOROOT_USER};
# :: change home path for existing user and set correct permission
RUN set -ex; \
usermod -d ${APP_ROOT} docker; \
chown -R 1000:1000 \
${APP_ROOT} \
/usr/lib/unifi \
/var/run/unifi \
/var/lib/unifi \
/var/log/unifi;
# :: Volumes
VOLUME ["${APP_ROOT}/var"]
# :: Monitor
HEALTHCHECK CMD /usr/local/bin/healthcheck.sh || exit 1
# :: Start
USER docker
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]