commit 5110b75eda839c383abd0b67e938f7914d3606bf Author: Dave Jansen Date: Sat Dec 6 13:34:37 2025 +0900 Initial commit diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..7d13ea0 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,15 @@ +# Stop the editor from looking for .editorconfig files in the parent directories +root = true + +[*] +# Non-configurable Prettier behaviors +charset = utf-8 +insert_final_newline = true +# Caveat: Prettier won't trim trailing whitespace inside template strings, but your editor might. +trim_trailing_whitespace = true + +# Configurable Prettier behaviors +end_of_line = lf +indent_style = space +indent_size = 2 +max_line_length = 80 diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml new file mode 100644 index 0000000..6ee6842 --- /dev/null +++ b/.gitea/workflows/build.yaml @@ -0,0 +1,96 @@ +--- +name: Build container image +on: + pull_request: + branches: + - main + #schedule: + # - cron: "05 4 */3 * *" # 4:05am every three days. + push: + branches: + - main + paths-ignore: + - "**/README.md" + workflow_dispatch: + +env: + REGISTRY_USER: ${{ github.repository_owner }} + REPO_URL: https://davejansen.dev/${{ github.repository_owner }}/${{ + github.event.repository.name }} + +concurrency: + group: ${{ github.workflow }}-${{ github.ref || github.run_id }}-${{ + inputs.brand_name}}-${{ inputs.stream_name }} + cancel-in-progress: true + +jobs: + build_push: + name: Build and push image + runs-on: ubuntu-24.04 + + permissions: + contents: read + packages: write + id-token: write + + steps: + - name: Prepare environment + run: | + # Lowercase the image uri + echo "IMAGE_REGISTRY=${IMAGE_REGISTRY,,}" >> ${GITHUB_ENV} + echo "IMAGE_NAME=${IMAGE_NAME,,}" >> ${GITHUB_ENV} + + - name: Checkout + uses: actions/checkout@v6 + + - name: Get current date + id: date + run: | + # This generates a timestamp like what is defined on the ArtifactHub documentation + # E.G: 2022-02-08T15:38:15Z' + # https://artifacthub.io/docs/topics/repositories/container-images/ + # https://linux.die.net/man/1/date + echo "date=$(date -u +%Y\-%m\-%d\T%H\:%M\:%S\Z)" >> $GITHUB_OUTPUT + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Container Registry + uses: docker/login-action@v3 + with: + registry: ${{ env.IMAGE_REGISTRY }} + username: ${{ env.REGISTRY_USER }} + password: ${{ secrets.REGISTRY_TOKEN }} + + - name: Build and push image + id: build_image + uses: docker/build-push-action@v6 + with: + push: true + tags: davejansen/caddy-bunny:latest + + # + # # This section is optional and only needs to be enabled if you plan on distributing + # # your project for others to consume. You will need to create a public and private key + # # using Cosign and save the private key as a repository secret in Github for this workflow + # # to consume. For more details, review the image signing section of the README. + # - name: Install Cosign + # uses: sigstore/cosign-installer@d7543c93d881b35a8faa02e8e3605f69b7a1ce62 # v3.10.0 + # if: github.event_name != 'pull_request' && github.ref == + # format('refs/heads/{0}', github.event.repository.default_branch) + # + # - name: Sign container image + # if: github.event_name != 'pull_request' && github.ref == + # format('refs/heads/{0}', github.event.repository.default_branch) + # env: + # IMAGE_FULL: + # ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME + # }} + # TAGS: ${{ steps.push.outputs.digest }} + # COSIGN_EXPERIMENTAL: false + # COSIGN_PRIVATE_KEY: ${{ secrets.SIGNING_SECRET }} + # COSIGN_PASSWORD: "" + # run: | + # for tag in ${{ steps.metadata.outputs.tags }}; do + # cosign sign -y --key env://COSIGN_PRIVATE_KEY $IMAGE_FULL:$tag + # done diff --git a/.markdownlint.json b/.markdownlint.json new file mode 100644 index 0000000..499c16b --- /dev/null +++ b/.markdownlint.json @@ -0,0 +1,8 @@ +{ + "line-length": { + "tables": false + }, + "no-inline-html": { + "allowed_elements": ["abbr", "pre", "kbd", "samp"] + } +} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..38a8809 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +ARG CADDY_VERSION=2 + +FROM caddy:$CADDY_VERSION-builder-alpine AS builder + +RUN xcaddy build \ + --with github.com/caddy-dns/bunny + +FROM caddy:$CADDY_VERSION-alpine + +COPY --from=builder /usr/bin/caddy /usr/bin/caddy diff --git a/README.md b/README.md new file mode 100644 index 0000000..b5c304e --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# Caddy with Bunny DNS module built-in + +A very basic container image based directly off of `caddy:2-alpine` with the bunny DNS module built.