|
| 1 | +name: Build OpenTracing Dependency |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + - cron: "30 4 * * 1" # run Mon at 04:30 UTC |
| 6 | + workflow_dispatch: |
| 7 | + inputs: |
| 8 | + nginx_version: |
| 9 | + type: string |
| 10 | + description: "NGINX Version to build OT for" |
| 11 | + required: false |
| 12 | + |
| 13 | +env: |
| 14 | + PLATFORMS: "linux/arm,linux/amd64,linux/arm64,linux/ppc64le,linux/s390x" |
| 15 | + |
| 16 | +concurrency: |
| 17 | + group: ${{ github.ref_name }}-ot-build |
| 18 | + cancel-in-progress: true |
| 19 | + |
| 20 | +jobs: |
| 21 | + build-docker: |
| 22 | + name: Build Docker Image |
| 23 | + runs-on: ubuntu-22.04 |
| 24 | + permissions: |
| 25 | + packages: write |
| 26 | + contents: read |
| 27 | + strategy: |
| 28 | + fail-fast: false |
| 29 | + matrix: |
| 30 | + os: [debian, alpine] |
| 31 | + steps: |
| 32 | + - name: Checkout Repository |
| 33 | + uses: actions/checkout@v4 |
| 34 | + with: |
| 35 | + repository: opentracing-contrib/nginx-opentracing |
| 36 | + ref: master |
| 37 | + |
| 38 | + - name: Variables |
| 39 | + id: var |
| 40 | + run: | |
| 41 | + if [ -n "${{ inputs.nginx_version }}" ]; then |
| 42 | + nginx_version="${{ inputs.nginx_version }}" |
| 43 | + else |
| 44 | + nginx_version=$(grep -m1 'FROM nginx:' <Dockerfile | awk -F'[: ]' '{print $3}') |
| 45 | + fi |
| 46 | + echo "nginx_version=${nginx_version}" |
| 47 | + echo "nginx_version=${nginx_version}" >> $GITHUB_OUTPUT |
| 48 | +
|
| 49 | + - name: Setup QEMU |
| 50 | + uses: docker/setup-qemu-action@v3 |
| 51 | + with: |
| 52 | + platforms: arm,arm64,ppc64le,s390x |
| 53 | + |
| 54 | + - name: Docker Buildx |
| 55 | + uses: docker/setup-buildx-action@v3 |
| 56 | + with: |
| 57 | + buildkitd-flags: --debug |
| 58 | + |
| 59 | + - name: Login to GitHub Container Registry |
| 60 | + uses: docker/login-action@v3 |
| 61 | + with: |
| 62 | + registry: ghcr.io |
| 63 | + username: ${{ github.repository_owner }} |
| 64 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 65 | + if: github.event_name != 'pull_request' |
| 66 | + |
| 67 | + - name: Docker meta |
| 68 | + id: meta |
| 69 | + uses: docker/metadata-action@v5 |
| 70 | + with: |
| 71 | + images: | |
| 72 | + name=ghcr.io/nginxinc/dependencies/nginx-ot,enable=true |
| 73 | + flavor: suffix=${{ matrix.os != 'debian' && format('-{0}', matrix.os) || '' }},onlatest=true |
| 74 | + tags: | |
| 75 | + type=raw,value=nginx-${{ steps.var.outputs.nginx_version }},enable=true |
| 76 | + env: |
| 77 | + DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index |
| 78 | + |
| 79 | + - name: Build and push |
| 80 | + uses: docker/build-push-action@v5 |
| 81 | + with: |
| 82 | + file: ./Dockerfile |
| 83 | + context: "." |
| 84 | + pull: true |
| 85 | + push: true |
| 86 | + platforms: "linux/arm,linux/amd64,linux/arm64,linux/ppc64le,linux/s390x" |
| 87 | + tags: ${{ steps.meta.outputs.tags }} |
| 88 | + labels: ${{ steps.meta.outputs.labels }} |
| 89 | + annotations: ${{ steps.meta.outputs.annotations }} |
| 90 | + cache-from: type=gha,scope=${{ matrix.os }} |
| 91 | + cache-to: type=gha,scope=${{ matrix.os }},mode=max |
| 92 | + target: final |
| 93 | + sbom: false |
| 94 | + provenance: mode=max |
| 95 | + build-args: | |
| 96 | + BUILD_OS=${{ matrix.os }} |
| 97 | + NGINX_VERSION=${{ steps.var.outputs.nginx_version }} |
0 commit comments