Compare commits

..

No commits in common. "main" and "2024.07.1" have entirely different histories.

8 changed files with 89 additions and 211 deletions

View file

@ -0,0 +1,39 @@
name: build dev image
on:
push:
branches:
- dev
jobs:
build-dev:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
endpoint: tcp://forgejo-docker-in-docker-1:2375
platforms: linux/amd64,linux/arm64,linux/arm/v7
- name: Build and push
uses: docker/build-push-action@v6
with:
context: ./docker-build/
file: ./docker-build/Dockerfile
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: true
cleanup: true
tags: |
${{ secrets.DOCKER_USER }}/docker-owndyndns-netcup:dev

View file

@ -9,7 +9,7 @@ jobs:
release_tag:
runs-on: ubuntu-latest
outputs:
new_release: ${{ steps.create_release.outputs.NEW_RELEASE }}
release: ${{ steps.create_release.outputs.RELEASE }}
steps:
- name: Checkout
uses: actions/checkout@v4
@ -18,32 +18,32 @@ jobs:
id: create_release
shell: bash
run: |
### Get latest release.
latest_release=$(curl -s ${{ env.GITHUB_API_URL }}/repos/${{ env.GITHUB_REPOSITORY }}/releases/latest | jq -r .tag_name)
# Get latest release.
latest_release=$(curl -s https://git.smail.koeln/api/v1/repos/homelab/docker-ownDynDNS-netcup/releases/latest | jq -r .tag_name)
### Cut release into year, month and counter.
# Cut release into year, month and counter.
year=$(echo $latest_release | awk -F '.' '//{print $1}')
month=$(echo $latest_release | awk -F '.' '//{print $2}')
counter=$(echo $latest_release | awk -F '.' '//{print $3}')
### increase the counter, if the release is from the same year and month
# increase the counter, if the release is from the same year and month
if [[ $(date +'%Y') == $year ]] && [[ $(date +'%m') == $month ]]; then
counter=$(($counter + 1));
### else reset counter
# else reset counter
else
counter=0;
fi
### Create
# Create
new_release=$(date +'%Y').$(date +'%m').$counter
echo "NEW_RELEASE=$new_release" >> "$GITHUB_OUTPUT"
echo "RELEASE=$new_release" >> "$GITHUB_OUTPUT"
echo "Release $new_release successfully set"
build:
runs-on: ubuntu-latest
needs: release_tag
env:
NEW_RELEASE: ${{ needs.release_tag.outputs.new_release }}
RELEASE: ${{ needs.release_tag.outputs.release }}
steps:
- name: Checkout
uses: actions/checkout@v4
@ -59,6 +59,8 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
endpoint: tcp://forgejo-docker-in-docker-1:2375
- name: Build and push
uses: docker/build-push-action@v6
@ -70,13 +72,13 @@ jobs:
cleanup: true
tags: |
${{ secrets.DOCKER_USER }}/docker-owndyndns-netcup:latest
${{ secrets.DOCKER_USER }}/docker-owndyndns-netcup:${{ env.NEW_RELEASE }}
${{ secrets.DOCKER_USER }}/docker-owndyndns-netcup:${{ needs.release_tag.outputs.release }}
publish_release:
needs: [release_tag, build]
runs-on: ubuntu-latest
env:
NEW_RELEASE: ${{ needs.release_tag.outputs.new_release }}
NEW_RELEASE: ${{ needs.release_tag.outputs.release }}
GH_TOKEN: "${{ secrets.RENOVATE_TOKEN }}"
steps:
- name: Checkout
@ -85,14 +87,14 @@ jobs:
- name: Create new release
shell: bash
run: |
### Get latest release "created at" timestemp
latest_release_time=$(date -d "$(curl -s ${{ env.GITHUB_API_URL }}/repos/${{ env.GITHUB_REPOSITORY }}/releases/latest | jq -r .created_at)")
# Get latest release "created at" timestemp
latest_release_time=$(date -d "$(curl -s https://git.smail.koeln/api/v1/repos/homelab/docker-ownDynDNS-netcup/releases/latest | jq -r .created_at)")
echo "Last release from $latest_release_time"
### Get last 50 commits
curl -s "${{ env.GITHUB_API_URL }}/repos/${{ env.GITHUB_REPOSITORY }}/commits?limit=50" > /tmp/last_50_commits.json
# Get last 50 commits
curl -s "https://git.smail.koeln/api/v1/repos/homelab/docker-ownDynDNS-netcup/commits?limit=50" > /tmp/last_50_commits.json
### Count commits (max. 50) between now and the latest release
# Count commits (max. 50) between now and the latest release
i=0
fin=0
@ -108,7 +110,7 @@ jobs:
fi
done
### Generate list of commit messages since latest release for release message
# Generate list of commit messages since latest release for release message
j=0
message_list=""
@ -120,15 +122,10 @@ jobs:
j=$((j + 1))
done
### Generate release message
# Generate release message
datetime=$(env TZ=Europe/Berlin date "+%A, %d.%m.%Y at %R")
body="$i commit(s) since last relase:\\n\\n$(echo $message_list | sed 's/"//g' | sed 's/README.md docker-build docker-compose.yaml example.config renovate.json/*/g')"
echo "Release Message Body: $body"
body="Automatically created on $datetime by forgejo action \\n\\n $i commit(s) since last relase:\\n\\n$(echo $message_list | sed 's/"//g' | sed 's/README.md docker-build docker-compose.yaml example.config renovate.json/*/g')"
echo "$body"
### Create release
curl -d "{
\"body\": \"$body\",
\"name\": \"${{ env.NEW_RELEASE }}\",
\"tag_name\": \"${{ env.NEW_RELEASE }}\",
\"target_commitish\": \"main\"
}" ${{ env.GITHUB_API_URL }}/repos/${{ env.GITHUB_REPOSITORY }}/releases -H "Authorization: token ${{ env.GITHUB_TOKEN }}" -H "Content-Type: application/json"
# Create release
curl -d "{\"body\": \"$body\", \"name\": \"$NEW_RELEASE\", \"tag_name\": \"$NEW_RELEASE\", \"target_commitish\": \"main\" }" https://git.smail.koeln/api/v1/repos/homelab/docker-ownDynDNS-netcup/releases -H "Authorization: token $GH_TOKEN" -H "Content-Type: application/json"

View file

@ -1,128 +0,0 @@
name: build dev image
on:
push:
branches:
- dev
jobs:
release_tag:
runs-on: ubuntu-latest
outputs:
new_release: ${{ steps.create_release.outputs.NEW_RELEASE }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get latest release and create new release
id: create_release
shell: bash
run: |
### Get latest release.
latest_release=$(curl -s ${{ env.GITHUB_API_URL }}/repos/${{ env.GITHUB_REPOSITORY }}/releases/latest | jq -r .tag_name)
### Cut release into year, month and counter.
year=$(echo $latest_release | awk -F '.' '//{print $1}')
month=$(echo $latest_release | awk -F '.' '//{print $2}')
counter=$(echo $latest_release | awk -F '.' '//{print $3}')
### Increase counter, if the release is from the same year and month
if [[ $(date +'%Y') == $year ]] && [[ $(date +'%m') == $month ]]; then
counter=$(($counter + 1));
# else reset counter
else
counter=0;
fi
### Create new release tag
new_release=$(date +'%Y').$(date +'%m').$counter
echo "NEW_RELEASE=$new_release" >> "$GITHUB_OUTPUT"
echo "Release $new_release successfully set"
build-dev:
needs: [release_tag]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
endpoint: tcp://docker-in-docker:2375
platforms: linux/amd64,linux/arm64,linux/arm/v7
- name: Build and push
uses: docker/build-push-action@v6
with:
context: ./docker-build/
file: ./docker-build/Dockerfile
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: true
cleanup: true
tags: |
${{ secrets.DOCKER_USER }}/docker-owndyndns-netcup:dev
publish_release:
needs: [release_tag, build]
runs-on: ubuntu-latest
env:
NEW_RELEASE: ${{ needs.release_tag.outputs.new_release }}
GH_TOKEN: "${{ secrets.RENOVATE_TOKEN }}"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create new release
shell: bash
run: |
### Get latest release "created at" timestemp
latest_release_time=$(date -d "$(curl -s ${{ env.GITHUB_API_URL }}/repos/${{ env.GITHUB_REPOSITORY }}/releases/latest | jq -r .created_at)")
echo "Last release from $latest_release_time"
### Get last 50 commits
curl -s "${{ env.GITHUB_API_URL }}/repos/${{ env.GITHUB_REPOSITORY }}/commits?limit=50" > /tmp/last_50_commits.json
### Count commits (max. 50) between now and the latest release
i=0
fin=0
while [[ $fin == 0 ]]; do
commit_time=$(date --date="$(< /tmp/last_50_commits.json jq -r --arg i "$i" '.[$i|tonumber] | .created' )");
if [[ $(date -d "$latest_release_time" +%s) -le $(date -d "$commit_time" +%s) ]]; then
echo "$i $commit_time"
i=$((i + 1))
else
fin=1;
fi
done
### Generate list of commit messages since latest release for release message
j=0
message_list=""
while [[ "$j" != "$i" ]]; do
message=$(< /tmp/last_50_commits.json jq -r --arg j "$j" '.[$j|tonumber] | .commit.message')
echo "$j $message"
message_newline="${message}\n\""
message_list="$message_list* $message_newline"
j=$((j + 1))
done
### Generate release message
datetime=$(env TZ=Europe/Berlin date "+%A, %d.%m.%Y at %R")
body="$i commit(s) since last relase:\\n\\n$(echo $message_list | sed 's/"//g' | sed 's/README.md docker-build docker-compose.yaml example.config renovate.json/*/g')"
echo "Release Message Body: $body"
### Ends with no release

View file

@ -1,8 +1,6 @@
# docker-ownDynDNS-netcup
# ownDynDNS-netcup
[![Worklfow](https://code.offene.cloud/homelab/docker-ownDynDNS-netcup/badges/workflows/build_main.yaml/badge.svg)](https://code.offene.cloud/homelab/docker-ownDynDNS-netcup) [![Release](https://code.offene.cloud/homelab/docker-ownDynDNS-netcup/badges/release.svg)](https://code.offene.cloud/homelab/docker-ownDynDNS-netcup/releases)
- [docker-ownDynDNS-netcup](#docker-owndyndns-netcup)
- [ownDynDNS-netcup](#owndyndns-netcup)
- [acknowledgments](#acknowledgments)
- [Netcup configuration](#netcup-configuration)
- [Container configuration](#container-configuration)
@ -11,32 +9,26 @@
## acknowledgments
This container is based on the work of:
* [Docker PHP](https://hub.docker.com/_/php)
* [PHP](https://hub.docker.com/_/php)
* [Fernwerker ownDynDNS](https://github.com/fernwerker/ownDynDNS)
## Netcup configuration
You need to create two dns entries beforehand:
You need to create your dns entries beforehand:
| Host | Type | Destination |
|----------|-------|--------------|
| vpn | AAAA | IPv6 |
| vpn | A | IPv4 |
| ddns | AAAA | IPv6 |
| ddns | A | IPv4 |
vpn.example.com -> the domain that gets updated
ddns.example.com -> the domain your Fritz!Box calls for updates
## Container configuration
Create compose.yml and config in your app directory i.e.:
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 compose.yml
vi docker-compose.yml
# Create config, copy the contents from repository example.config and change the parameters
vi config
@ -49,8 +41,8 @@ docker compose up -d
* Login to your Fritz!Box
* Go to /Internet/Freigabe/DynDNS
* Set mark on "DynDNS benutzen"
* Enter Update-URL: `https://ddns.example.com/update.php?user=<username>&password=<pass>&ipv4=<ipaddr>&ipv6=<ip6addr>&domain=<domain>`
* You only have to change `https://ddns.example.com` (http without valid TLS certificate)
* Enter Update-URL: `https://<url of your webspace>/update.php?user=<username>&password=<pass>&ipv4=<ipaddr>&ipv6=<ip6addr>&domain=<domain>`
* You only have to change `https://<url of your webspace>` (http without valid TLS certificate)
* Domainname: `vpn.example.com`
* Username: Defined in config
* Password: Defined in config

View file

@ -1,22 +1,23 @@
# Get latest app version
FROM alpine:3.22.0
FROM alpine:3.20.1
WORKDIR /clone-workspace
RUN apk update && \
apk upgrade && \
apk add git && \
git clone https://github.com/fernwerker/ownDynDNS.git
apk add git
RUN git clone https://github.com/fernwerker/ownDynDNS.git
# Build container to run the app
FROM php:8.4.8-apache
FROM php:8.3.9-apache
WORKDIR /var/www/html
RUN apt-get update && \
RUN apt-get update -y && \
apt-get upgrade -y && \
apt-get install --no-install-recommends -y \
libxml2-dev && \
docker-php-ext-install soap && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
apt-get install -y \
libxml2-dev
RUN docker-php-ext-install soap
RUN apt-get clean -y
COPY --chown=www-data:www-data --from=0 /clone-workspace/ownDynDNS /var/www/html
COPY --chown=www-data:www-data --from=0 /clone-workspace/ownDynDNS/.htaccess.example /var/www/html/.htaccess
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/

View file

@ -1,4 +1,5 @@
---
version: "3"
services:
ownDynDNS:
image: sujiba/docker-owndyndns-netcup:latest

View file

@ -2,14 +2,5 @@
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"local>homelab/renovate-config"
],
"baseBranches": ["main"],
"useBaseBranchConfig": "merge",
"packageRules": [
{
"description": "Automerge dependency updates",
"matchUpdateTypes": ["minor", "patch", "pin", "digest"],
"automerge": true
}
]
}

View file

@ -1,15 +0,0 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"local>homelab/renovate-config"
],
"baseBranches": ["dev"],
"useBaseBranchConfig": "merge",
"packageRules": [
{
"description": "Automerge dependency updates",
"matchUpdateTypes": ["major", "minor", "patch", "pin", "digest"],
"automerge": true
}
]
}