forked from jpmeijers/ttn-resin-gateway-rpi
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile.template.metering
61 lines (47 loc) · 1.87 KB
/
Dockerfile.template.metering
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
FROM resin/%%RESIN_MACHINE_NAME%%-debian:latest AS buildstep
# downloading utils
RUN apt-get update && \
apt-get install wget build-essential libc6-dev git pkg-config protobuf-compiler libprotobuf-dev libprotoc-dev automake libtool autoconf
WORKDIR /etc
# versions
ENV NODE_EXPORTER_VERSION 0.12.0
ENV DIST_ARCH linux-armv7
RUN wget https://github.com/prometheus/node_exporter/releases/download/${NODE_EXPORTER_VERSION}/node_exporter-${NODE_EXPORTER_VERSION}.${DIST_ARCH}.tar.gz \
&& tar xvfz node_exporter-${NODE_EXPORTER_VERSION}.${DIST_ARCH}.tar.gz \
&& rm node_exporter-${NODE_EXPORTER_VERSION}.${DIST_ARCH}.tar.gz
COPY gwexporter.tgz /opt/ttn-gateway/gwexporter.tgz
WORKDIR /opt/gwexporter
RUN tar xvzf /opt/ttn-gateway/gwexporter.tgz
RUN wget https://nodejs.org/dist/v8.8.1/node-v8.8.1-linux-armv6l.tar.gz \
&& tar xvzf node-v8.8.1-linux-armv6l.tar.gz \
&& mv node-v8.8.1-linux-armv6l/* . \
&& rm -rf node-v8.8.1-linux-armv6l
WORKDIR /opt/ttn-gateway/
COPY dev dev
RUN ./dev/build.sh
FROM resin/%%RESIN_MACHINE_NAME%%-debian:latest
RUN apt-get update && \
apt-get install ntpdate python && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Enable systemd
ENV INITSYSTEM on
# versions
ENV NODE_EXPORTER_VERSION 0.12.0
ENV DIST_ARCH linux-armv7
WORKDIR /etc
COPY --from=buildstep /etc/node_exporter-${NODE_EXPORTER_VERSION}.${DIST_ARCH} .
WORKDIR /opt/gwexporter
COPY --from=buildstep /opt/gwexporter .
WORKDIR /opt/ttn-gateway
COPY --from=buildstep /opt/ttn-gateway/mp_pkt_fwd .
COPY --from=buildstep /opt/ttn-gateway/ResetIC880A .
COPY --from=buildstep /opt/ttn-gateway/config-pin /usr/bin/
COPY --from=buildstep /opt/ttn-gateway/test_loragw_* ./
COPY --from=buildstep /usr/local/lib/libpaho-embed-* /usr/lib/
COPY --from=buildstep /usr/lib/libttn* /usr/lib/
COPY run.py run.py
WORKDIR /
COPY start.sh.metering start.sh
# run when container lands on device
CMD ["bash", "start.sh"]