FarrowStrange / hetzner-api-dyndns

A small script to dynamically update DNS records using the Hetzner DNS-API.
GNU General Public License v3.0
138 stars 38 forks source link

Dockerfile example alpine with cron enabled #26

Open FloCola opened 2 years ago

FloCola commented 2 years ago

quite handy, have it running on a Synology NAS. Should be running almost anywhere.

Preconfig:

# 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" ]
kladderadeng commented 1 year ago

Awesome @FloCola! That helped me a lot :-)

thcrt commented 11 months ago

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.