-
Notifications
You must be signed in to change notification settings - Fork 17
/
Dockerfile
112 lines (91 loc) · 3.46 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
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
FROM solita/ubuntu-systemd:latest
# configure apt for non standard packages
RUN apt-get update \
&& apt-get install -y \
curl apt-transport-https \
pkg-config
# add node 9.x repo
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -
# add yarn repo
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
# install build tools
RUN apt-get update \
&& apt-get install -y \
git yarn nodejs python bzip2
# install dependencies
RUN apt-get install -y \
dbus libdbus-1-dev docker.io
# Replace reboot with a command to restart the container
RUN rm /sbin/reboot
RUN echo "#!/bin/sh\ndocker restart webui" > /sbin/reboot
RUN chmod +x /sbin/reboot
# wpantund
# install modules
WORKDIR /usr/local/bin/wpantund
COPY ./docker/wpantund/package.json .
RUN npm_config_tmp=/tmp TMP=/tmp yarn
# install app
COPY ./docker/wpantund/.babelrc ./.babelrc
COPY ./docker/wpantund/src ./src
RUN npm_config_tmp=/tmp TMP=/tmp yarn build
RUN rm -rf ./src
# install configuration files
COPY ./docker/wpantund/com.nestlabs.WPANTunnelDriver.conf /etc/dbus-1/system.d
# install init script
COPY ./docker/wpantund/wpantund.service /lib/systemd/system/wpantund.service
COPY ./docker/wpantund/wpantund.sh /usr/local/bin/wpantund.sh
RUN chmod +x /usr/local/bin/wpantund.sh
RUN systemctl enable wpantund
# knotd mock
# install modules
WORKDIR /usr/local/bin/knotd
COPY ./docker/knotd/package.json .
RUN npm_config_tmp=/tmp TMP=/tmp yarn
# install app
COPY ./docker/knotd/.babelrc ./.babelrc
COPY ./docker/knotd/src ./src
RUN npm_config_tmp=/tmp TMP=/tmp yarn build
RUN rm -rf ./src
# install configuration files
COPY ./docker/knotd/config ./config
COPY ./docker/knotd/br.org.cesar.knot.conf /etc/dbus-1/system.d
# install init script
COPY ./docker/knotd/knotd.service /lib/systemd/system/knotd.service
COPY ./docker/knotd/knotd.sh /usr/local/bin/knotd.sh
RUN chmod +x /usr/local/bin/knotd.sh
RUN systemctl enable knotd
# devices
# install modules
WORKDIR /usr/local/bin/devices
COPY ./docker/devices/package.json .
RUN npm_config_tmp=/tmp TMP=/tmp yarn
# install app
COPY ./docker/devices/.babelrc ./.babelrc
COPY ./docker/devices/src ./src
RUN npm_config_tmp=/tmp TMP=/tmp yarn build
RUN rm -rf ./src
# install script
COPY ./docker/devices/devices.sh /usr/local/bin/devices.sh
RUN chmod +x /usr/local/bin/devices.sh
# knot-web
# install modules
WORKDIR /usr/local/bin/knot-web-app
COPY package.json .
RUN npm_config_tmp=/tmp TMP=/tmp yarn
# install configuration files
RUN mkdir -p /etc/knot
COPY ./config/gatewayConfig.json ./config/keys.json /etc/knot/
COPY ./docker/thingd/start.sh ./docker/thingd/stop.sh /etc/knot/
RUN chmod +x /etc/knot/start.sh /etc/knot/stop.sh
RUN mkdir -p /usr/local/bin/knot-fog-source && touch /usr/local/bin/knot-fog-source/.env
RUN mkdir -p /usr/local/bin/knot-fog-connector && mkdir -p /usr/local/bin/knot-fog-connector/config
COPY ./docker/knot-fog-connector/config.json /usr/local/bin/knot-fog-connector/config/default.json
RUN mkdir -p /usr/local/bin/thingd && mkdir -p /usr/local/bin/thingd/config
COPY ./docker/thingd/config.conf /usr/local/bin/thingd/config/default.conf
# install init script
COPY ./docker/knot-web/knot-web.service /lib/systemd/system/knot-web.service
COPY ./docker/knot-web/knot-web.sh /usr/local/bin/knot-web.sh
RUN chmod +x /usr/local/bin/knot-web.sh
RUN systemctl enable knot-web
CMD ["/bin/bash", "-c", "exec /sbin/init --log-target=journal 3>&1"]