forked from TheThingsNetwork/lorawan-stack
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
51 lines (33 loc) · 1.85 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
FROM alpine AS builder
COPY ttn-lw-stack /bin/ttn-lw-stack
RUN chmod 755 /bin/ttn-lw-stack
COPY ttn-lw-cli /bin/ttn-lw-cli
RUN chmod 755 /bin/ttn-lw-cli
COPY data/lorawan-frequency-plans /srv/ttn-lorawan/lorawan-frequency-plans
RUN rm -rf /srv/ttn-lorawan/lorawan-frequency-plans/.git
COPY data/lorawan-webhook-templates /srv/ttn-lorawan/lorawan-webhook-templates
RUN rm -rf /srv/ttn-lorawan/lorawan-webhook-templates/.git
COPY data/lorawan-devices /tmp/lorawan-devices
RUN mkdir -p /srv/ttn-lorawan/lorawan-devices-index && \
/bin/ttn-lw-stack dr-db init --dr.source=directory --dr.directory="/tmp/lorawan-devices"
FROM alpine:3.12
RUN addgroup -g 886 thethings && adduser -u 886 -S -G thethings thethings
RUN apk --update --no-cache add ca-certificates curl
COPY --from=builder /bin/ttn-lw-stack /bin/ttn-lw-stack
RUN ln -s /bin/ttn-lw-stack /bin/stack
COPY --from=builder /bin/ttn-lw-cli /bin/ttn-lw-cli
RUN ln -s /bin/ttn-lw-cli /bin/cli
COPY public /srv/ttn-lorawan/public
COPY --from=builder /srv/ttn-lorawan/lorawan-frequency-plans /srv/ttn-lorawan/lorawan-frequency-plans
COPY --from=builder /srv/ttn-lorawan/lorawan-webhook-templates /srv/ttn-lorawan/lorawan-webhook-templates
COPY --from=builder /srv/ttn-lorawan/lorawan-devices-index /srv/ttn-lorawan/lorawan-devices-index
RUN chown thethings:thethings -R /srv/ttn-lorawan/lorawan-devices-index
EXPOSE 1700/udp 1881 8881 1882 8882 1883 8883 1884 8884 1885 8885 1887 8887
RUN mkdir /srv/ttn-lorawan/public/blob
VOLUME ["/srv/ttn-lorawan/public/blob"]
ENV TTN_LW_BLOB_LOCAL_DIRECTORY=/srv/ttn-lorawan/public/blob \
TTN_LW_IS_DATABASE_URI=postgres://root@cockroach:26257/ttn_lorawan?sslmode=disable \
TTN_LW_REDIS_ADDRESS=redis:6379 \
TTN_LW_HEALTHCHECK_URL=http://localhost:1885/healthz/live
HEALTHCHECK --interval=1m --timeout=5s CMD curl -f $TTN_LW_HEALTHCHECK_URL || exit 1
USER thethings:thethings