diff --git a/Dockerfile b/Dockerfile index f5d2006..4cacd49 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,4 +15,4 @@ FROM dependencies AS release WORKDIR / COPY cloudflare-ddns.py . COPY config.json . -CMD ["python", "/cloudflare-ddns.py"] \ No newline at end of file +CMD ["python", "/cloudflare-ddns.py", "--repeat"] \ No newline at end of file diff --git a/README.md b/README.md index 54f2b64..4f9b5ff 100755 --- a/README.md +++ b/README.md @@ -45,7 +45,17 @@ Alternatively, you can use the traditional API keys by setting appropriate value ## :fax: Hosting multiple domains on the same IP? You can save yourself some trouble when hosting multiple domains pointing to the same IP address (in the case of Traefik) by defining one A & AAAA record 'ddns.example.com' pointing to the IP of the server that will be updated by this DDNS script. For each subdomain, create a CNAME record pointing to 'ddns.example.com'. Now you don't have to manually modify the script config every time you add a new subdomain to your site! -## :running: Running +## Deploy to Docker + +Create a config.json file with your production credentials and run the build-docker-image script. + +```bash +chmod +x ./build-docker-image.sh +./build-docker-image.sh +docker run -d timothymiller/cloudflare_ddns:latest +``` + +## (Legacy) :running: Running This script requires Python 3.5+, which comes preinstalled on the latest version of Raspbian. Download/clone this repo and give permission to the project's bash script by running `chmod +x ./start-sync.sh`. Now you can execute `./start-sync.sh`, which will set up a virtualenv, pull in any dependencies, and fire the script. diff --git a/cloudflare-ddns.py b/cloudflare-ddns.py index f8181ab..5669008 100755 --- a/cloudflare-ddns.py +++ b/cloudflare-ddns.py @@ -125,6 +125,8 @@ def updateIPs(): print("Checking " + ip["type"] + " records") commitRecord(ip) +if(len(sys.argv) > 1): + if(sys.argv[1] == "--repeat"): + import threading + threading.Thread(target=lambda: every(60*15, updateIPs)).start() updateIPs() -import threading -threading.Thread(target=lambda: every(60*15, updateIPs)).start() \ No newline at end of file