feat: initial commit
Some checks failed
Build and Push Docker Image / build (push) Failing after 39s

This commit is contained in:
Linloir 2024-10-06 16:24:28 +08:00
commit 6fba8ac7c1
No known key found for this signature in database
GPG Key ID: 225A2CCCFFD62E4E
3 changed files with 55 additions and 0 deletions

View File

@ -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

19
build_all.sh Normal file
View File

@ -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

10
builds/dns/Dockerfile Normal file
View File

@ -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