diff --git a/.github/workflows/build.caddy-gandi.yml b/.github/workflows/build.caddy-gandi.yml new file mode 100644 index 0000000..ac69023 --- /dev/null +++ b/.github/workflows/build.caddy-gandi.yml @@ -0,0 +1,107 @@ +# Workflow to build and push a Docker image to Docker Hub, GitHub and Quay Container Registries +name: Build caddy-gandi + +# Controls when the action will run +on: + workflow_dispatch: # allows to run the workflow manually from the Actions tab + schedule: + - cron: '0 0 1 * *' # runs at 00:00 on the first day of every month + push: + branches: main + paths: + - caddy-gandi/Dockerfile + +# Environment variables available to all jobs and steps in this workflow +env: + DOCKER_BUILDKIT: 1 + DOCKER_NAME: caddy-gandi + DOCKER_DESCRIPTION: "Caddy Docker custom build with Gandi DNS module" + +# Jobs to run once the workflow is triggered +jobs: + # Job to get image and repository details + metadata: + name: Get image and repository details + runs-on: ubuntu-latest + + outputs: + version: ${{ steps.version.outputs.version }} + labels: ${{ steps.metadata.outputs.labels }} + tags: ${{ steps.metadata.outputs.tags }} + platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/s390x,linux/arm/v7,linux/arm/v6 + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + ref: main + + - name: Parse Caddy version + id: version + run: echo "version=$(grep -Eo 'caddy:[0-9]+\.[0-9]+\.[0-9]+$' $DOCKER_NAME/Dockerfile | cut -d ':' -f2)" | tee -a $GITHUB_OUTPUT + + - name: Generate image metadata with Caddy version + uses: docker/metadata-action@v5 + id: metadata + with: + images: | + docker.io/${{ github.actor }}/${{ env.DOCKER_NAME }} + ghcr.io/${{ github.actor }}/${{ env.DOCKER_NAME }} + quay.io/${{ github.actor }}/${{ env.DOCKER_NAME }} + tags: | + type=semver,pattern={{version}},value=v${{ steps.version.outputs.version }} + type=semver,pattern={{major}}.{{minor}},value=v${{ steps.version.outputs.version }} + type=semver,pattern={{major}},value=v${{ steps.version.outputs.version }} + labels: | + org.opencontainers.image.title=${{ env.DOCKER_NAME }} + org.opencontainers.image.description=${{ env.DOCKER_DESCRIPTION }} + + # Job to build and publish Docker image + build: + name: Build and publish Docker image + runs-on: ubuntu-latest + needs: metadata + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + ref: main + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ github.actor }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Login to GitHub Container Repository + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ github.token }} + + - name: Login to Quay Container Registry + uses: docker/login-action@v3 + with: + registry: quay.io + username: ${{ github.actor }} + password: ${{ secrets.QUAY_TOKEN }} + + - name: Build and publish container image + uses: docker/build-push-action@v6 + id: build + with: + context: . + file: ./${{ env.DOCKER_NAME }}/Dockerfile + push: true + provenance: false + tags: ${{ needs.metadata.outputs.tags }} + labels: ${{ needs.metadata.outputs.labels }} + platforms: ${{ needs.metadata.outputs.platforms }} \ No newline at end of file diff --git a/.github/workflows/update-tag-release.yml b/.github/workflows/update-tag-release.yml index 8555cac..919c82e 100644 --- a/.github/workflows/update-tag-release.yml +++ b/.github/workflows/update-tag-release.yml @@ -29,6 +29,7 @@ env: caddy-duckdns-ddns-crowdsec caddy-duckdns-ddns-crowdsec-geoip-security caddy-eventsexec + caddy-gandi caddy-netcup caddy-netcup-ddns caddy-porkbun-dockerproxy diff --git a/README.md b/README.md index 0cef687..c2f21e6 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,7 @@ If you are looking for a specific custom build not available yet in this reposit - [**caddy-duckdns-ddns-crowdsec**](https://github.com/serfriz/caddy-custom-builds/tree/main/caddy-duckdns-ddns-crowdsec): includes DuckDNS Dynamic DNS and CrowdSec Bouncer modules. - [**caddy-duckdns-ddns-crowdsec-geoip-security**](https://github.com/serfriz/caddy-custom-builds/tree/main/caddy-duckdns-ddns-crowdsec-geoip-security): includes DuckDNS Dynamic DNS, CrowdSec Bouncer, GeoIP Filter and Caddy Security modules. - [**caddy-eventsexec**](https://github.com/serfriz/caddy-custom-builds/tree/main/caddy-eventsexec): includes Events Exec module. +- [**caddy-gandi**](https://github.com/serfriz/caddy-custom-builds/tree/main/caddy-gandi): includes Gandi DNS module. - [**caddy-netcup**](https://github.com/serfriz/caddy-custom-builds/tree/main/caddy-netcup): includes Netcup DNS module. - [**caddy-netcup-ddns**](https://github.com/serfriz/caddy-custom-builds/tree/main/caddy-netcup): includes Netcup Dynamic DNS module. - [**caddy-porkbun-dockerproxy**](https://github.com/serfriz/caddy-custom-builds/tree/main/caddy-porkbun-dockerproxy): includes Porkbun DNS and Docker Proxy modules. @@ -42,6 +43,7 @@ If you are looking for a specific custom build not available yet in this reposit - [**Cloudflare DNS**](https://github.com/serfriz/caddy-custom-builds?tab=readme-ov-file#dns-modules): for Cloudflare DNS-01 ACME validation support | [caddy-dns/cloudflare](https://github.com/caddy-dns/cloudflare) - [**Cloudflare IPs**](https://github.com/serfriz/caddy-custom-builds?tab=readme-ov-file#cloudflare-ips): to retrieve Cloudflare's current [IP ranges](https://www.cloudflare.com/ips/) | [WeidiDeng/caddy-cloudflare-ip](https://github.com/WeidiDeng/caddy-cloudflare-ip) - [**DuckDNS**](https://github.com/serfriz/caddy-custom-builds?tab=readme-ov-file#dns-modules): for DuckDNS DNS-01 ACME validation support | [caddy-dns/duckdns](https://github.com/caddy-dns/duckdns) +- [**Gandi DNS**](https://github.com/serfriz/caddy-custom-builds?tab=readme-ov-file#dns-modules): for Gandi DNS-01 ACME validation support | [caddy-dns/gandi](https://github.com/caddy-dns/gandi) - [**Netcup DNS**](https://github.com/serfriz/caddy-custom-builds?tab=readme-ov-file#dns-modules): for Netcup DNS-01 ACME validation support | [caddy-dns/netcup](https://github.com/caddy-dns/netcup) - [**Porkbun DNS**](https://github.com/serfriz/caddy-custom-builds?tab=readme-ov-file#dns-modules): for Porkbun DNS-01 ACME validation support | [caddy-dns/porkbun](https://github.com/caddy-dns/porkbun) - [**Dynamic DNS**](https://github.com/serfriz/caddy-custom-builds?tab=readme-ov-file#dynamic-dns): updates the DNS records with the public IP address of your instance | [mholt/caddy-dynamicdns](https://github.com/mholt/caddy-dynamicdns) @@ -92,6 +94,7 @@ docker run --rm -it \ -e CLOUDFLARE_API_TOKEN= \ # Cloudflare API token (if applicable) -e DUCKDNS_API_TOKEN= \ # DuckDNS API token (if applicable) -e CROWDSEC_API_KEY= \ # CrowdSec API key (if applicable) + -e GANDI_BEARER_TOKEN= \ # Gandi API token (if applicable) -e NETCUP_CUSTOMER_NUMBER= \ # Netcup customer number (if applicable) -e NETCUP_API_KEY= \ # Netcup API key (if applicable) -e NETCUP_API_PASSWORD= \ # Netcup API password (if applicable) @@ -129,6 +132,7 @@ services: - CLOUDFLARE_API_TOKEN= # Cloudflare API token (if applicable) - DUCKDNS_API_TOKEN= # DuckDNS API token (if applicable) - CROWDSEC_API_KEY= # CrowdSec API key (if applicable) + - GANDI_BEARER_TOKEN= # Gandi API token (if applicable) - NETCUP_CUSTOMER_NUMBER= # Netcup customer number (if applicable) - NETCUP_API_KEY= # Netcup API key (if applicable) - NETCUP_API_PASSWORD= # Netcup API password (if applicable) @@ -173,6 +177,7 @@ To make use of the different modules that provide DNS-01 ACME validation support { acme_dns cloudflare {env.CLOUDFLARE_API_TOKEN} # for Cloudflare # acme_dns duckdns {env.DUCKDNS_API_TOKEN} # for DuckDNS + # acme_dns gandi {env.GANDI_BEARER_TOKEN} # for Gandi # acme_dns netcup { # for Netcup # customer_number {env.NETCUP_CUSTOMER_NUMBER} # api_key {env.NETCUP_API_KEY} @@ -192,6 +197,7 @@ my.domain.tld { tls { dns cloudflare {env.CLOUDFLARE_API_TOKEN} # for Cloudflare # dns duckdns {env.DUCKDNS_API_TOKEN} # for DuckDNS + # dns gandi {env.GANDI_BEARER_TOKEN} # for Gandi # dns netcup { # for Netcup # customer_number {env.NETCUP_CUSTOMER_NUMBER} # api_key {env.NETCUP_API_KEY} diff --git a/caddy-gandi/Dockerfile b/caddy-gandi/Dockerfile new file mode 100644 index 0000000..a200a28 --- /dev/null +++ b/caddy-gandi/Dockerfile @@ -0,0 +1,9 @@ +# syntax=docker/dockerfile:1 +FROM caddy:2.8.4-builder AS builder + +RUN xcaddy build \ + --with github.com/caddy-dns/gandi + +FROM caddy:2.8.4 + +COPY --from=builder /usr/bin/caddy /usr/bin/caddy \ No newline at end of file diff --git a/caddy-gandi/README.md b/caddy-gandi/README.md new file mode 100644 index 0000000..a3b18ee --- /dev/null +++ b/caddy-gandi/README.md @@ -0,0 +1,35 @@ +# Caddy Docker build with Gandi DNS module + +[![Docker Hub](https://img.shields.io/badge/Docker%20Hub%20-%20serfriz%2Fcaddy--gandi%20-%20%230db7ed?style=flat&logo=docker)](https://hub.docker.com/r/serfriz/caddy-gandi) +[![GitHub](https://img.shields.io/badge/GitHub%20-%20serfriz%2Fcaddy--gandi%20-%20%23333?style=flat&logo=github)](https://ghcr.io/serfriz/caddy-gandi) +[![Quay](https://img.shields.io/badge/Quay%20-%20serfriz%2Fcaddy--gandi%20-%20%23CC0000?style=flat&logo=redhat)](https://quay.io/serfriz/caddy-gandi) + +[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/serfriz/caddy-custom-builds?label=Release)](https://github.com/serfriz/caddy-custom-builds/releases) +[![GitHub build status](https://img.shields.io/github/actions/workflow/status/serfriz/caddy-custom-builds/build.caddy-gandi.yml?label=Build)](https://github.com/serfriz/caddy-custom-builds/actions/workflows/build.caddy-gandi.yml) + +This image is updated automatically by GitHub Actions when a new version of [Caddy](https://github.com/caddyserver/caddy) is released using the official [Caddy Docker](https://hub.docker.com/_/caddy) image and the following module: +- [**Gandi DNS**](https://github.com/serfriz/caddy-custom-builds?tab=readme-ov-file#dns-modules): for Gandi DNS-01 ACME validation support | [caddy-dns/gandi](https://github.com/caddy-dns/gandi) + +## Usage + +Since this image built off the official Caddy Docker image, the same [volumes](https://docs.docker.com/storage/volumes/) and/or [bind mounts](https://docs.docker.com/storage/bind-mounts/), ports mapping, etc. can be used with this container. Additional [environment variables](https://caddyserver.com/docs/caddyfile/concepts#environment-variables) may be needed for the added module. Please, refer to the repository's [README](https://github.com/serfriz/caddy-custom-builds?tab=readme-ov-file#container-creation) file for further usage instructions. + +Docker builds for all Caddy supported platforms available at the following container registries: +- [**Docker Hub**](https://hub.docker.com/r/serfriz/caddy-gandi) `docker pull serfriz/caddy-gandi:latest` +- [**GitHub Packages**](https://ghcr.io/serfriz/caddy-gandi) `docker pull ghcr.io/serfriz/caddy-gandi:latest` +- [**Quay**](https://quay.io/serfriz/caddy-gandi) `docker pull quay.io/serfriz/caddy-gandi:latest` + +### Tags + +The following tags are available for the `serfriz/caddy-gandi` image: + +- `latest` +- `` (eg: `2.7.4`, including: `2.7`, `2`, etc.) + +## Contributing + +Feel free to contribute, request additional Caddy images with your preferred modules, and make things better by opening an [Issue](https://github.com/serfriz/caddy-custom-builds/issues) or [Pull Request](https://github.com/serfriz/caddy-custom-builds/pulls). + +## License + +Software under [GPL-3.0](https://github.com/serfriz/caddy-custom-builds/blob/main/LICENSE) ensures users' freedom to use, modify, and distribute it while keeping the source code accessible. It promotes transparency, collaboration, and knowledge sharing. Users agree to comply with the GPL-3.0 license terms and provide the same freedom to others. \ No newline at end of file