Latest Docker Image #22
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Latest Docker Image | |
on: | |
workflow_dispatch: {} | |
push: | |
tags: | |
- v* | |
jobs: | |
metadata: | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.meta.outputs.version }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
ghcr.io/${{ github.repository_owner }}/cloudflare-tunnel-ingress-controller | |
tags: | | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
type=sha | |
build-amd64: | |
needs: metadata | |
permissions: | |
packages: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push AMD64 | |
uses: docker/build-push-action@v5 | |
with: | |
file: image/cloudflare-tunnel-ingress-controller/Dockerfile | |
platforms: linux/amd64 | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ghcr.io/${{ github.repository_owner }}/cloudflare-tunnel-ingress-controller:${{ needs.metadata.outputs.version }}-amd64 | |
labels: ${{ needs.metadata.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
build-arm64: | |
needs: metadata | |
permissions: | |
packages: write | |
runs-on: orbstack-vm-arm64 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push ARM64 | |
uses: docker/build-push-action@v5 | |
with: | |
file: image/cloudflare-tunnel-ingress-controller/Dockerfile | |
platforms: linux/arm64 | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ghcr.io/${{ github.repository_owner }}/cloudflare-tunnel-ingress-controller:${{ needs.metadata.outputs.version }}-arm64 | |
labels: ${{ needs.metadata.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
create-manifest: | |
needs: [metadata, build-amd64, build-arm64] | |
permissions: | |
packages: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create and push manifest | |
run: | | |
docker buildx imagetools create -t ghcr.io/${{ github.repository_owner }}/cloudflare-tunnel-ingress-controller:${{ needs.metadata.outputs.version }} \ | |
ghcr.io/${{ github.repository_owner }}/cloudflare-tunnel-ingress-controller:${{ needs.metadata.outputs.version }}-amd64 \ | |
ghcr.io/${{ github.repository_owner }}/cloudflare-tunnel-ingress-controller:${{ needs.metadata.outputs.version }}-arm64 | |
# Create additional tags from metadata | |
for tag in $(echo "${{ needs.metadata.outputs.tags }}" | tr '\n' ' '); do | |
if [[ $tag != *":${{ needs.metadata.outputs.version }}" ]]; then | |
docker buildx imagetools create -t $tag \ | |
ghcr.io/${{ github.repository_owner }}/cloudflare-tunnel-ingress-controller:${{ needs.metadata.outputs.version }}-amd64 \ | |
ghcr.io/${{ github.repository_owner }}/cloudflare-tunnel-ingress-controller:${{ needs.metadata.outputs.version }}-arm64 | |
fi | |
done |