|
1 | | -name: Build and push Caddy Docker Images |
| 1 | +name: Build and push Caddy images |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
5 | | - branches: |
6 | | - - main |
7 | | -# paths: |
8 | | -# - 'caddy/**' |
9 | | -# - 'caddy/**' |
| 5 | + branches: [main] |
10 | 6 |
|
11 | 7 | jobs: |
12 | | - build_and_push_v2-7-6: |
13 | | - if: contains(github.event.head_commit.message, 'build/caddy:2.7.6') || contains(github.event.head_commit.message, 'build/all') |
| 8 | + build: |
14 | 9 | runs-on: ubuntu-latest |
15 | 10 |
|
16 | | - steps: |
17 | | - - name: Checkout repository |
18 | | - uses: actions/checkout@v2 |
19 | | - |
20 | | - - name: Set up Docker Buildx |
21 | | - uses: docker/setup-buildx-action@v2 |
22 | | - |
23 | | - - name: Log in to Docker Hub |
24 | | - uses: docker/login-action@v2 |
25 | | - with: |
26 | | - username: ${{ secrets.DOCKER_USERNAME }} |
27 | | - password: ${{ secrets.DOCKER_PASSWORD }} |
28 | | - |
29 | | - - name: Build and push |
30 | | - run: cd ./caddy && docker buildx build -t rlkvch/caddy:2.7.6 -t rlkvch/caddy:v2.7-latest --platform linux/amd64,linux/arm,linux/arm64,linux/ppc64le -f Dockerfile.caddy-2.7.6 --push . |
31 | | - |
32 | | - build_and_push_v2-8-0-beta-2: |
33 | | - runs-on: ubuntu-latest |
34 | | - if: contains(github.event.head_commit.message, 'build/caddy:2.8.0-beta.2') || contains(github.event.head_commit.message, 'build/all') |
35 | | - |
36 | | - steps: |
37 | | - - name: Checkout repository |
38 | | - uses: actions/checkout@v2 |
39 | | - |
40 | | - - name: Set up Docker Buildx |
41 | | - uses: docker/setup-buildx-action@v2 |
42 | | - |
43 | | - - name: Log in to Docker Hub |
44 | | - uses: docker/login-action@v2 |
45 | | - with: |
46 | | - username: ${{ secrets.DOCKER_USERNAME }} |
47 | | - password: ${{ secrets.DOCKER_PASSWORD }} |
48 | | - |
49 | | - - name: Build and push |
50 | | - run: cd ./caddy && docker buildx build -t rlkvch/caddy:v2.8.0-beta.2 -t rlkvch/caddy:v2.8-latest --platform linux/amd64,linux/arm,linux/arm64,linux/arm,linux/ppc64le -f Dockerfile.caddy-2.8.0-beta.2 --push . |
51 | | - |
52 | | - build_and_push_v2-10-0: |
53 | | - runs-on: ubuntu-latest |
54 | | - if: contains(github.event.head_commit.message, 'build/caddy:2.10.0') || contains(github.event.head_commit.message, 'build/all') |
| 11 | + # один job – несколько конфигураций |
| 12 | + strategy: |
| 13 | + fail-fast: false |
| 14 | + matrix: |
| 15 | + include: |
| 16 | + - version: "2.7.6" |
| 17 | + dockerfile: "Dockerfile.caddy-2.7.6" |
| 18 | + tags: | |
| 19 | + rlkvch/caddy:2.7.6 |
| 20 | + rlkvch/caddy:v2.7-latest |
| 21 | + platforms: linux/amd64,linux/arm,linux/arm64,linux/ppc64le |
| 22 | + filter: "build/caddy:2.7.6" |
| 23 | + - version: "2.8.0-beta.2" |
| 24 | + dockerfile: "Dockerfile.caddy-2.8.0-beta.2" |
| 25 | + tags: | |
| 26 | + rlkvch/caddy:v2.8.0-beta.2 |
| 27 | + rlkvch/caddy:v2.8-latest |
| 28 | + platforms: linux/amd64,linux/arm,linux/arm64,linux/ppc64le |
| 29 | + filter: "build/caddy:2.8.0-beta.2" |
| 30 | + - version: "2.10.0" |
| 31 | + dockerfile: "Dockerfile.caddy-2.10.0" |
| 32 | + tags: | |
| 33 | + rlkvch/caddy:2.10.0 |
| 34 | + rlkvch/caddy:v2.10-latest |
| 35 | + biggiko/caddy:v2.10 |
| 36 | + biggiko/caddy:v2.10-latest |
| 37 | + platforms: linux/amd64,linux/arm64 |
| 38 | + filter: "build/caddy:2.10.0" |
| 39 | + |
| 40 | + # собираем только нужные образы |
| 41 | + if: contains(github.event.head_commit.message, matrix.filter) || |
| 42 | + contains(github.event.head_commit.message, 'build/all') |
55 | 43 |
|
56 | 44 | steps: |
57 | | - - name: Checkout repository |
58 | | - uses: actions/checkout@v2 |
59 | | - |
60 | | - - name: Set up Docker Buildx |
61 | | - uses: docker/setup-buildx-action@v2 |
62 | | - |
63 | | - - name: Log in to Docker Hub |
64 | | - uses: docker/login-action@v2 |
65 | | - with: |
66 | | - username: ${{ secrets.DOCKER_USERNAME }} |
67 | | - password: ${{ secrets.DOCKER_PASSWORD }} |
68 | | - |
69 | | - - name: Build and push |
70 | | - run: cd ./caddy && docker buildx build --tag rlkvch/caddy:2.10.0 --tag rlkvch/caddy:v2.10-latest --tag biggiko/caddy:v2.10 --tag biggiko/caddy:v2.10-latest --platform linux/amd64,linux/arm64 -f Dockerfile.caddy-2.10.0 --push . |
| 45 | + - uses: actions/checkout@v4 |
| 46 | + |
| 47 | + - name: Set up QEMU (кросс-сборка) |
| 48 | + uses: docker/setup-qemu-action@v3 |
| 49 | + |
| 50 | + - name: Set up Buildx |
| 51 | + uses: docker/setup-buildx-action@v3 |
| 52 | + |
| 53 | + - name: Log in to Docker Hub |
| 54 | + uses: docker/login-action@v3 |
| 55 | + with: |
| 56 | + registry: docker.io # явный реестр |
| 57 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 58 | + password: ${{ secrets.DOCKERHUB_TOKEN }} # персональный access-token |
| 59 | + |
| 60 | + - name: Build & push ${{ matrix.version }} |
| 61 | + uses: docker/build-push-action@v5 |
| 62 | + with: |
| 63 | + context: ./caddy |
| 64 | + file: ./caddy/${{ matrix.dockerfile }} |
| 65 | + push: true |
| 66 | + tags: ${{ matrix.tags }} |
| 67 | + platforms: ${{ matrix.platforms }} |
| 68 | + cache-from: type=gha # кеш в Actions |
| 69 | + cache-to: type=gha,mode=max |
0 commit comments