Ricard Illa 2022-08-22 18:28:36 +02:00
parent 84fd65767b
commit 20ba0467d1
No known key found for this signature in database
GPG Key ID: F69A672B72E54902
4 changed files with 77 additions and 1 deletions

View File

@ -1,7 +1,7 @@
REGISTRY=registry.monotremata.xyz
PLATFORMS=linux/amd64,linux/arm64
IMAGES=agate buildx-qemu mpd pleroma rainloop rsync static-page-builder tor transmission webdav
IMAGES=agate buildx-qemu mpd pleroma rainloop rsync sendxmpp static-page-builder tor transmission webdav
.PHONY: all $(IMAGES)
@ -27,6 +27,9 @@ rainloop:
rsync:
$(BUILDX)
sendxmpp:
$(BUILDX)
static-page-builder:
$(BUILDX)

18
sendxmpp/Dockerfile Normal file
View File

@ -0,0 +1,18 @@
FROM alpine:3.16
ADD entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh && \
apk add --no-cache go-sendxmpp && \
addgroup \
--gid 10001 \
sendxmpp && \
adduser \
--uid 10000 \
--ingroup sendxmpp \
--disabled-password \
--shell /sbin/nologin \
sendxmpp
USER sendxmpp
ENTRYPOINT ["/entrypoint.sh"]

24
sendxmpp/Makefile Normal file
View File

@ -0,0 +1,24 @@
IMG_NAME=sendxmpp
REGISTRY=registry.monotremata.xyz
IMG=$(REGISTRY)/$(IMG_NAME)
PLATFORMS=linux/amd64,linux/arm64
.PHONY: push buildx clean
out/image-id: Dockerfile entrypoint.sh
mkdir -p $(@D)
docker build -t $(IMG) .
echo $(IMG) > $@
push: out/image-id
docker image push $(IMG)
buildx: Dockerfile entrypoint.sh
docker buildx build \
--platform $(PLATFORMS) \
--tag $(IMG) \
--push \
.
clean:
rm -rf out

31
sendxmpp/entrypoint.sh Normal file
View File

@ -0,0 +1,31 @@
#!/bin/sh
MESSAGE="${MESSAGE:-${PLUGIN_MESSAGE}}"
if [ -z "$MESSAGE" ]; then
echo "'message' must specified"
exit 1
fi
USERNAME="${USERNAME:-${PLUGIN_USERNAME}}"
if [ -z "$USERNAME" ]; then
echo "'username' must specified"
exit 1
fi
PASSWORD="${PASSWORD:-${PLUGIN_PASSWORD}}"
if [ -z "$USERNAME" ]; then
echo "'username' must specified"
exit 1
fi
RECIPIENT="${RECIPIENT:-${PLUGIN_RECIPIENT}}"
if [ -z "$RECIPIENT" ]; then
echo "'recipient' must specified"
exit 1
fi
exec echo "$MESSAGE" | \
go-sendxmpp \
--username="${USERNAME}"\
--password="${PASSWORD}" \
"${RECIPIENT}"