commit 2cf3c0bdaa1f2db744f390b7b97a95d529f4abee Author: William Brawner Date: Tue Nov 14 22:00:48 2023 -0700 Initial commit diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 0000000..0d6bf34 --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,44 @@ +name: Publish Docker image +on: + push: + branches: main + tags: + - '*' + +jobs: + push_to_registry: + name: Push Docker image to GitHub Packages + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v2 + - name: Docker meta + id: meta + uses: docker/metadata-action@v4 + with: + images: | + ghcr.io/wbrawner/caddy-porkbun + tags: | + type=schedule + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + type=sha + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push + uses: docker/build-push-action@v3 + with: + context: . + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..23d0bc1 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +FROM caddy:2-builder-alpine AS builder + +RUN xcaddy build --with github.com/caddy-dns/porkbun@v0.1.4 + +FROM caddy:2-alpine + +COPY --from=builder /usr/bin/caddy /usr/bin/caddy diff --git a/README.md b/README.md new file mode 100644 index 0000000..c261834 --- /dev/null +++ b/README.md @@ -0,0 +1,34 @@ +# Caddy with Porkbun DNS Plugin + +## Usage + +Make sure to set the `PORKBUN_API_KEY` and `PORKBUN_API_SECRET_KEY` environment +variables to the corresponding values. + +Then add the appropriate Caddy json config: + +``` +{ + "module": "acme", + "challenges": { + "dns": { + "provider": { + "name": "porkbun", + "api_key": "{env.PORKBUN_API_KEY}", + "api_secret_key": "{env.PORKBUN_API_SECRET_KEY}" + } + } + } +} +``` + +or Caddyfile equivalent: + +``` +tls { + dns porkbun { + api_key {env.PORKBUN_API_KEY} + api_secret_key {env.PORKBUN_API_SECRET_KEY} + } +} +```