json2collectdmqtt: create new Docker image

This commit is contained in:
Starbeamrainbowlabs 2022-06-30 18:56:31 +01:00
parent d9e8ad00b6
commit fdc4c64f40
Signed by: sbrl
GPG key ID: 1BE5172E637709C2
4 changed files with 32 additions and 0 deletions

View file

@ -74,6 +74,7 @@ Image | Purpose
`imap-download` | Fetchmail, procmail, inotifywait, and munpack working together to download emails and extract attachments. The provided fetchmailrc must be owned by `10000:10000`.
`archivebox` | Dockerised [ArchiveBox](https://archivebox.io/)
`tinyproxy` | Dockerised [tinyproxy](https://tinyproxy.github.io/) - config file should be mounted read-only to `/srv/tinyproxy.conf`
`json2collectdmqtt` | Dockerised [json2collectdmqtt](https://github.com/sbrl/json2collectdmqtt) - `KEY=value` environment file should be mounted to `/srv/env`
## Docker container UID/GID map
@ -92,6 +93,8 @@ UID | GID | Container | Notes
0 | 0 | imap-download | Uses fetchmail to download emails and extract attachments. The provided fetchmailrc must be owned by `10000:10000`, and be chmodded to `0700`.
10200 | 10200 | archivebox |
10300 | 10300 | tinyproxy |
10400 | 10400 | json2collectdmqtt | `chown` environment file to `10400:10400`, as it's loaded by a startup shell script inside the container
## Development Notes

View file

@ -0,0 +1,15 @@
ARG REPO_LOCATION
# ARG BASE_VERSION
FROM ${REPO_LOCATION}minideb-node
RUN npm install --global json2collectdmqtt && rm -rf "$(npm get cache)";
COPY ./run.sh /usr/local/bin/run.sh
VOLUME [ "/srv" ]
USER 80:80
ENV NODE_ENV production
WORKDIR /srv
ENTRYPOINT [ "/usr/local/bin/run.sh" ]

13
images/json2collectdmqtt/run.sh Executable file
View file

@ -0,0 +1,13 @@
#!/usr/bin/env bash
# Username / password are best stored in an env file rather than a Nomad job file
if [[ -r "/srv/env" ]]; then
#shellcheck disable=SC2046
export $(xargs </srv/env);
fi
if [[ -n "${MQTT_SERVER}" ]]; then
JSON2COLLECTDMQTT_ARGS="${JSON2COLLECTDMQTT_ARGS} --server ${MQTT_SERVER}";
fi
exec json2collectdmqtt

View file

@ -0,0 +1 @@
docker