Skip to content

caddy

caddy #53

Workflow file for this run

name: caddy
on:
workflow_dispatch:
schedule:
- cron: '0 16 1,15 * *'
jobs:
build:
strategy:
matrix:
plugin: [cloudflare,alidns,azure,dnspod,googleclouddns,duckdns]
runs-on: ubuntu-latest
steps:
- name: Check Out
uses: actions/checkout@v3
- name: Setup timezone
uses: zcong1993/setup-timezone@master
with:
timezone: Asia/Shanghai
- name: ready
run: |
cp ./caddy/Dockerfile ./Dockerfile
sed -i "s/\${plugin}/${{ matrix.plugin }}/" ./Dockerfile
# docker login
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
# 设置 docker buildx 环境
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
# build 前置操作
- name: Docker before
id: docker_before
run: |
image="${{ secrets.DOCKER_HUB_USERNAME }}/caddy-dns"
tags="$image:${{matrix.plugin}}_$(date +'%y-%m-%d_%H-%M'),$image:${{matrix.plugin}}"
echo "target images $tags"
echo "tags=$tags" >> $GITHUB_OUTPUT
# 一个特殊镜像,修复某些buildx 的 bug
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes > /dev/null 2>&1
# build 并且 push docker 镜像
- name: Build and push
id: docker_build
uses: docker/build-push-action@v3
with:
context: .
file: ./Dockerfile
push: true
tags: ${{steps.docker_before.outputs.tags}}
platforms: linux/amd64,linux/arm64/v8
# 打印 docker 镜像 SHA256 Hash 值
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}