Last active
January 27, 2020 23:22
-
-
Save tcastberg/f3744574df14286874085660e09b5237 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -x | |
if [ "${OUTPUT}" = "json" ]; then WMOUTPUT=--robot=json; | |
elif [ "${OUTPUT}" = "mqtt" ]; then WMOUTPUT="--shell='mosquitto_pub -h ${MQTT_HOSTNAME:-localhost} -p ${MQTT_HOSTPORT:-1883} -t ${MQTT_TOPIC:-meter} -m \"\$METER_JSON\"'"; fi | |
if [ -z "${METERTYPE}" ]; then echo "METERTYPE not defined"; fi | |
if [ -z "${METERID}" ]; then echo "METERID not defined"; fi | |
if [ -z "${METERKEY}" ]; then echo "METERKEY not defined"; fi | |
export MQTT_HOSTNAME | |
export MQTT_HOSTPORT | |
export MQTT_TOPIC | |
/wmbusmeters/wmbusmeters --debug ${WMOUTPUT} ${DEVICE:-auto} ${NAME:-MyMeter} ${METERTYPE} ${METERID} ${METERKEY} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM alpine:latest AS build | |
RUN apk add --no-cache alpine-sdk | |
RUN git clone https://github.com/tcastberg/wmbusmeters.git | |
WORKDIR /wmbusmeters | |
RUN make | |
FROM alpine:latest as scratch | |
ENV QEMU_EXECVE=1 | |
RUN apk add --no-cache mosquitto-clients libstdc++ | |
WORKDIR /wmbusmeters | |
COPY --from=build /wmbusmeters/build/wmbusmeters /wmbusmeters/wmbusmeters | |
COPY docker-entrypoint.sh /wmbusmeters/docker-entrypoint.sh | |
CMD ["/wmbusmeters/docker-entrypoint.sh"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment