hetzner-api-dyndns
hetzner-api-dyndns copied to clipboard
Dockerfile example alpine with cron enabled
quite handy, have it running on a Synology NAS. Should be running almost anywhere.
Preconfig:
- Download script, save it accessible for the container.
- Script: Change first line to '#!/bin/ash'
- Script: Preconfigure Script-Parameters, or add script parameters to cronjob.
- Dockerfile: Change echo for cronjobs to your needs. See example.
- Mount Container Folder with scripts to '/srv'
# Dockerfile to create image with cron services
FROM alpine:latest
#Configure
RUN apk add --no-cache curl
RUN apk add --no-cache bind-tools
RUN apk add --no-cache jq
#Cronjobs
RUN echo '*/5 * * * * /bin/ash /srv/hetzner-dyndns_alpine.sh >> /srv/hetzner-dyndns.log' >> /root/crontab.conf
# Add the cron job
RUN crontab /root/crontab.conf
# Run the command on container startup
CMD [ "/usr/sbin/crond", "-f", "-d8" ]
Awesome @FloCola! That helped me a lot :-)
It's worth noting that installing bind-tools should no longer be necessary, as #35 uses an HTTP API to get the host's IP instead of using dig or nslookup.
It could be a good idea to automate Docker builds to GHCR.