-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
56 lines (50 loc) · 1.29 KB
/
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
FROM alpine:3.8
MAINTAINER Gabriel Ionescu <[email protected]>
# CREATE USER
ARG DOCKER_USERID
ARG DOCKER_GROUPID
ARG DOCKER_USERNAME
ENV DOCKER_USERID $DOCKER_USERID
ENV DOCKER_GROUPID $DOCKER_GROUPID
ENV DOCKER_USERNAME $DOCKER_USERNAME
RUN echo -e "\n > CREATE DOCKER USER: $DOCKER_USERNAME\n" \
&& addgroup -g $DOCKER_GROUPID $DOCKER_USERNAME \
&& adduser -D -u $DOCKER_USERID -G $DOCKER_USERNAME $DOCKER_USERNAME
# INSTALL ZIGBEE2MQTT
ENV ZIGBEE2MQTT_PATH /app/zigbee2mqtt
RUN echo -e "\n > INSTALL ZIGBEE2MQTT IN $ZIGBEE2MQTT_PATH\n" \
&& apk add --no-cache --virtual=build-dependencies \
make \
gcc \
g++ \
python \
linux-headers \
udev \
git \
&& apk add --no-cache \
nodejs \
npm \
\
&& git clone https://github.com/koenkk/zigbee2mqtt $ZIGBEE2MQTT_PATH \
&& cd $ZIGBEE2MQTT_PATH \
&& cp data/configuration.yaml ./ \
\
&& npm install --unsafe-perm \
&& npm i semver mqtt winston moment js-yaml object-assign-deep mkdir-recursive rimraf \
\
&& echo -e "\n > CLEANUP\n" \
&& apk del --purge \
build-dependencies \
&& rm -rf \
$ZIGBEE2MQTT_PATH/.git \
/tmp/* \
/var/tmp/* \
/root/*
# COPY APP FILES
COPY app/run.sh /app/run.sh
# WORKDIR
WORKDIR /app
# SWITCH USER
USER $DOCKER_USERNAME
# LAUNCH
CMD ["ash", "run.sh"]