From 6fba8ac7c1ed1c4e65cf211c4423dfd364d6751c Mon Sep 17 00:00:00 2001 From: Linloir <3145078758@qq.com> Date: Sun, 6 Oct 2024 16:24:28 +0800 Subject: [PATCH] feat: initial commit --- .gitea/workflows/build.yml | 26 ++++++++++++++++++++++++++ build_all.sh | 19 +++++++++++++++++++ builds/dns/Dockerfile | 10 ++++++++++ 3 files changed, 55 insertions(+) create mode 100644 .gitea/workflows/build.yml create mode 100644 build_all.sh create mode 100644 builds/dns/Dockerfile diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml new file mode 100644 index 0000000..b1f5e55 --- /dev/null +++ b/.gitea/workflows/build.yml @@ -0,0 +1,26 @@ +name: Build and Push Docker Image + +on: + push: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Build and push Docker images + run: ./build_all.sh diff --git a/build_all.sh b/build_all.sh new file mode 100644 index 0000000..080313a --- /dev/null +++ b/build_all.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +# Loop through each directory in the builds directory +for dir in builds/*/ ; do + # Remove trailing slash from directory name + dir=${dir%/} + + # Extract the folder name + folder_name=$(basename $dir) + + # Build the Docker image + docker build -t caddy-$folder_name $dir + + # Tag the Docker image for pushing to the repository + docker tag caddy-$folder_name linloir/caddy-$folder_name + + # Push the Docker image to the repository + docker push linloir/caddy-$folder_name +done \ No newline at end of file diff --git a/builds/dns/Dockerfile b/builds/dns/Dockerfile new file mode 100644 index 0000000..7755ecc --- /dev/null +++ b/builds/dns/Dockerfile @@ -0,0 +1,10 @@ +FROM caddy:builder AS builder + +RUN xcaddy build \ + --with github.com/caddy-dns/cloudflare \ + --with github.com/caddy-dns/dnspod \ + --with github.com/caddy-dns/alidns + +FROM caddy:latest + +COPY --from=builder /usr/bin/caddy /usr/bin/caddy