Dockerfile 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. from debian as build-rtl_433
  2. RUN apt-get update && apt-get upgrade -y && apt-get clean
  3. RUN apt-get update && apt-get install -y libtool libusb-1.0.0-dev librtlsdr-dev rtl-sdr build-essential autoconf cmake pkg-config git && apt-get clean
  4. RUN git clone https://github.com/merbanan/rtl_433.git
  5. WORKDIR /rtl_433
  6. RUN mkdir -p build
  7. WORKDIR /rtl_433/build
  8. RUN cmake -DCMAKE_INSTALL_PREFIX=/rtl_433/install ../
  9. RUN make -j $(nproc) install
  10. from debian as build-logger
  11. RUN apt-get update && apt-get upgrade -y
  12. #############################
  13. from golang as build-log
  14. RUN mkdir -p /go/src/git.snppla.net/snppla/log_temperature
  15. ADD ./ /go/src/git.snppla.net/snppla/log_temperature/
  16. WORKDIR /go/src/git.snppla.net/snppla/log_temperature/temperature_logger
  17. ENV GOPATH /go
  18. ENV GOBIN /go/bin
  19. RUN go get
  20. RUN go install
  21. WORKDIR /go/src/git.snppla.net/snppla/log_temperature/json_get/
  22. RUN go get
  23. RUN go install
  24. #############################
  25. from debian as json_get
  26. COPY --from=build-log /go/bin/json_get /usr/bin
  27. ENV DB temperature
  28. ENV USER ""
  29. ENV PASSWORD ""
  30. ENV HOST http://localhost:80
  31. ENV DB_HOST http://localhost:8086
  32. ENV LOCATION "unknown"
  33. ENV DELAY 60
  34. CMD json_get -db $DB -host $HOST -dbHost $DB_HOST -location $LOCATION -password $PASSWORD -user $USER -delay $DELAY
  35. ##############################
  36. from debian as log_temperature
  37. RUN apt-get update && apt-get upgrade -y && apt-get clean
  38. RUN apt-get update && apt-get install -y librtlsdr0 && apt-get clean
  39. COPY --from=build-rtl_433 /rtl_433/install/bin/rtl_433 /usr/bin
  40. COPY --from=build-log /go/bin/temperature_logger /usr/bin
  41. ENV DB temperature
  42. ENV USER ""
  43. ENV PASSWORD ""
  44. ENV HOST http://localhost:8086
  45. ENV RTL_ARGS ""
  46. ENV LOCATIONS ""
  47. CMD rtl_433 $RTL_ARGS -F json | temperature_logger -host $HOST -db $DB -password $PASSWORD -user $USER $LOCATIONS
  48. ##############################