Compare commits
10 Commits
8defedbae8
...
master
Author | SHA1 | Date | |
---|---|---|---|
c64a359255 | |||
865e3fbca0 | |||
b94fbc891a | |||
a872c40919 | |||
de5072b5af | |||
5601c25ea4 | |||
304e970a5e | |||
3edfa6e50b | |||
98ad197a05 | |||
f54a766829 |
@@ -2,7 +2,7 @@ kind: pipeline
|
|||||||
name: default
|
name: default
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: docker
|
- name: Uploading to DockerHub
|
||||||
image: plugins/docker
|
image: plugins/docker
|
||||||
settings:
|
settings:
|
||||||
username:
|
username:
|
||||||
@@ -11,6 +11,6 @@ steps:
|
|||||||
from_secret: docker_password
|
from_secret: docker_password
|
||||||
repo: sthopeless/temp2mqtt
|
repo: sthopeless/temp2mqtt
|
||||||
tags: latest
|
tags: latest
|
||||||
purge: false
|
purge: true
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile_x86_64
|
||||||
|
|
19
Dockerfile
19
Dockerfile
@@ -1,19 +0,0 @@
|
|||||||
FROM alpine:latest
|
|
||||||
|
|
||||||
LABEL org.opencontainers.image.source="https://git.sthope.dev/sthope/DockerContainer-randomPwd"
|
|
||||||
LABEL Maintainer="Sthope"
|
|
||||||
LABEL Description="Send CPU Temp via MQTT"
|
|
||||||
LABEL version="1.0.0"
|
|
||||||
|
|
||||||
ARG PUID=1000
|
|
||||||
ARG PGID=1000
|
|
||||||
|
|
||||||
RUN set -xe \
|
|
||||||
&& addgroup -g ${PGID} -S mosquitto \
|
|
||||||
&& adduser -u ${PUID} -G mosquitto -h /mosquitto/ -D mosquitto \
|
|
||||||
&& apk add --no-cache --purge -uU mosquitto mosquitto-libs mosquitto-clients
|
|
||||||
|
|
||||||
WORKDIR /workspace
|
|
||||||
COPY root/defaults/temp2mqtt /workspace
|
|
||||||
|
|
||||||
CMD [ "sh", "./temp2mqtt" ]
|
|
28
Dockerfile_x86_64
Normal file
28
Dockerfile_x86_64
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
FROM alpine:latest
|
||||||
|
|
||||||
|
ARG S6_OVERLAY_VERSION=3.1.0.1
|
||||||
|
|
||||||
|
|
||||||
|
LABEL org.opencontainers.image.source="https://git.sthope.dev/sthope/DockerContainer-randomPwd"
|
||||||
|
LABEL Maintainer="Sthope"
|
||||||
|
LABEL Description="Send CPU Temp via MQTT"
|
||||||
|
LABEL version="1.0.0"
|
||||||
|
|
||||||
|
ARG PUID=1000
|
||||||
|
ARG PGID=1000
|
||||||
|
|
||||||
|
RUN set -xe \
|
||||||
|
&& addgroup -g ${PGID} -S mosquitto \
|
||||||
|
&& adduser -u ${PUID} -G mosquitto -h /mosquitto/ -D mosquitto \
|
||||||
|
&& apk add --no-cache --purge -uU mosquitto mosquitto-libs mosquitto-clients
|
||||||
|
|
||||||
|
WORKDIR /config
|
||||||
|
# COPY root/defaults/temp2mqtt /config
|
||||||
|
|
||||||
|
CMD [ "sh", "/config/temp2mqtt" ]
|
||||||
|
|
||||||
|
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz /tmp
|
||||||
|
RUN tar -C / -Jxpf /tmp/s6-overlay-noarch.tar.xz
|
||||||
|
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-x86_64.tar.xz /tmp
|
||||||
|
RUN tar -C / -Jxpf /tmp/s6-overlay-x86_64.tar.xz
|
||||||
|
ENTRYPOINT ["/init"]
|
@@ -1,2 +1,3 @@
|
|||||||
# DockerContainer-SendTemp2MQTT
|
# DockerContainer-SendTemp2MQTT
|
||||||
|
|
||||||
|
[](https://git.sthope.dev/sthope/DockerContainer-SendTemp2MQTT)
|
@@ -8,7 +8,7 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
- PGID=1000
|
- PGID=1000
|
||||||
- PUID=1000
|
- PUID=1000
|
||||||
- PROXMOX_NAME=Icecrown
|
- PROXMOX_NAME=proxmox_name
|
||||||
- MQTT_BROKER=mqtt_ip
|
- MQTT_BROKER=mqtt_ip
|
||||||
- USERNAME=mqtt_username
|
- USERNAME=mqtt_username
|
||||||
- PASSWORD=mqtt_password
|
- PASSWORD=mqtt_password
|
||||||
|
@@ -7,8 +7,8 @@ PROXMOX_NAME="${PROXMOX_NAME:-pve}";
|
|||||||
|
|
||||||
TEMP=$(clear;sensors | sed -n 9p | sed 's/^[^=:]*[=:]//' | sed -r 's/\s+//g');
|
TEMP=$(clear;sensors | sed -n 9p | sed 's/^[^=:]*[=:]//' | sed -r 's/\s+//g');
|
||||||
|
|
||||||
[[ ! -f /mosquitto/config/temp2mqtt ]] && touch /mosquitto/config/temp2mqtt;
|
[[ ! -f /config/temp2mqtt ]] && touch /config/temp2mqtt;
|
||||||
cat <<EOF >> /mosquitto/config/temp2mqtt
|
cat <<EOF >> /config/temp2mqtt
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# ___ _ _ _ __
|
# ___ _ _ _ __
|
||||||
# / __|| |_ | |_ ___ | '_ \ ___
|
# / __|| |_ | |_ ___ | '_ \ ___
|
||||||
@@ -25,5 +25,5 @@ TEMP=$(clear;sensors | sed -n 9p | sed 's/^[^=:]*[=:]//' | sed -r 's/\s+//g');
|
|||||||
mosquitto_pub -h "${MQTT_BROKER}" -u "${USERNAME}" -P "${PASSWORD}" -t proxmox/"${PROXMOX_NAME}"/cpu_temp -m "${TEMP}"
|
mosquitto_pub -h "${MQTT_BROKER}" -u "${USERNAME}" -P "${PASSWORD}" -t proxmox/"${PROXMOX_NAME}"/cpu_temp -m "${TEMP}"
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
chown -R mosquitto:mosquitto /mosquitto/;
|
chown -R mosquitto:mosquitto /config/temp2mqtt;
|
||||||
chmod +x /mosquitto/config/temp2mqtt;
|
chmod +x /config/temp2mqtt;
|
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/with-contenv bash
|
#!/usr/bin/with-contenv bash
|
||||||
|
|
||||||
cd /mosquitto/config || exit 1;
|
cd /config/ || exit 1;
|
||||||
|
|
||||||
while /mosquitto/config/temp2mqtt; do sleep 10; done
|
while /config/temp2mqtt; do sleep 10; done
|
Reference in New Issue
Block a user