commit d3cfe6540dcd0ef20faef0527180a832c28f4b3d Author: sujiba Date: Thu May 30 23:04:58 2024 +0200 first commit :rocket: diff --git a/.github/workflows/docker_build_push.yml b/.github/workflows/docker_build_push.yml new file mode 100755 index 0000000..2f35ccf --- /dev/null +++ b/.github/workflows/docker_build_push.yml @@ -0,0 +1,43 @@ +name: Build and push dyndns-netcup + +on: + push: + branches: [main] +jobs: + build: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v2 + - + name: Login to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USER }} + password: ${{ secrets.DOCKER_ACCESS_TOKEN }} + - + name: Set up variables + run: | + VER=$(cat ./docker-build/VERSION) + echo "VERSION=$VER" >> $GITHUB_ENV + - + name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - + name: Build and push + uses: docker/build-push-action@v2 + with: + context: ./docker-build + file: ./docker-build/Dockerfile + platforms: | + linux/arm/v7 + linux/arm64 + linux/amd64 + push: true + tags: | + ${{ secrets.DOCKER_USER }}/docker-owndyndns-netcup:${{ env.VERSION }} + ${{ secrets.DOCKER_USER }}/docker-owndyndns-netcup:latest diff --git a/.gitignore b/.gitignore new file mode 100755 index 0000000..2eea525 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.env \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100755 index 0000000..3a9326b --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "ansible.python.interpreterPath": "/usr/bin/python3" +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100755 index 0000000..9769ccc --- /dev/null +++ b/README.md @@ -0,0 +1,43 @@ +# ownDynDNS-netcup + +![docker-build](https://github.com/sujiba/ownDynDNS-netcup/actions/workflows/docker_build_push.yml/badge.svg?event=push) + + +This container is based on the work of: +* [PHP](https://hub.docker.com/_/php) +* [Fernwerker ownDynDNS](https://github.com/fernwerker/ownDynDNS) + +## Nectup configuration +You need to create your dns entries beforehand: + +| Host | Type | Destination | +|----------|-------|--------------| +| vpn | AAAA | IPv6 | +| vpn | A | IPv4 | + +## Container configuration +Create docker-compose.yml and config in your app directory i.e.: + +``` +mkdir -p /opt/docker/owndyndns +cd /opt/docker/owndyndns + +# Create docker-compose.yml and copy the contents from repository file +vi docker-compose.yml + +# Create config, copy the contents from repository file and change the parameters +vi config + +# Start the Container with +docker compose up -d +``` + +## Fritz!Box configuration +* Login to your Fritz!Box +* Go to /Internet/Freigabe/DynDNS +* Set mark on "DynDNS benutzen" +* Enter Update-URL: `https:///update.php?user=&password=&ipv4=&ipv6=&domain=` + * You only have to change `https://` (http without valid TLS certificate) +* Domainname: `vpn.example.com` +* Username: Defined in config +* Password: Defined in config diff --git a/config b/config new file mode 100755 index 0000000..9357b45 --- /dev/null +++ b/config @@ -0,0 +1,8 @@ +username="max_mustermann" +password="s3cr3t" +customerId="netcup customer ID" +apiKey="netcup DNS API Key" +apiPassword="netcup DNS API Password" +debug=true +log=true +logFile=log.json diff --git a/docker-build/Dockerfile b/docker-build/Dockerfile new file mode 100755 index 0000000..8a2d06e --- /dev/null +++ b/docker-build/Dockerfile @@ -0,0 +1,20 @@ +# Get latest app version +FROM alpine/git +WORKDIR /clone-workspace +RUN git clone https://github.com/fernwerker/ownDynDNS.git + +# Build container to run the app +FROM php:apache + +RUN apt-get update -y && \ + apt-get upgrade -y && \ + apt-get install -y \ + libxml2-dev && \ + apt-get clean -y && \ + docker-php-ext-install soap + +WORKDIR /var/www/html +COPY --from=0 /clone-workspace/ownDynDNS /var/www/html +COPY --from=0 /clone-workspace/ownDynDNS/.htaccess.example /var/www/html/.htaccess + +RUN chown -R www-data:www-data /var/www/html/ diff --git a/docker-build/README.md b/docker-build/README.md new file mode 100755 index 0000000..df61ef0 --- /dev/null +++ b/docker-build/README.md @@ -0,0 +1,20 @@ +# Build it yourself + +https://docs.docker.com/buildx/working-with-buildx/#work-with-builder-instances + + ``` + # This creates a new builder instance with a single node based on your current configuration. + docker buildx create + # To list all available builders, use + docker buildx ls + # To switch between different builders, use + docker buildx use + # After creating a new instance, you can delete it with + docker buildx rm +``` + +Build it as a multi-platform image: +``` +chmod +x build_and_push.sh +./build_and_push.sh +``` \ No newline at end of file diff --git a/docker-build/VERSION b/docker-build/VERSION new file mode 100755 index 0000000..e43b916 --- /dev/null +++ b/docker-build/VERSION @@ -0,0 +1 @@ +2024.05.0 diff --git a/docker-build/build_and_push.sh b/docker-build/build_and_push.sh new file mode 100755 index 0000000..ed39007 --- /dev/null +++ b/docker-build/build_and_push.sh @@ -0,0 +1,2 @@ +docker buildx build --platform linux/arm/v7,linux/arm64/v8,linux/amd64 -t sujiba/docker-owndyndns-netcup:`cat VERSION` --push . +docker buildx build --platform linux/arm/v7,linux/arm64/v8,linux/amd64 -t sujiba/docker-owndyndns-netcup:latest --push . \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100755 index 0000000..35c7875 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,14 @@ +version: "3" + +services: + ownDynDNS: + image: sujiba/docker-owndyndns-netcup + container_name: ownDynDNS + # Run container behind reverse proxy + ports: + - "127.0.0.1:8081:80" + environment: + - TZ=Europe/Berlin + volumes: + - ./config:/var/www/html/ownDynDNS/.env + restart: unless-stopped