Build Docker Images #1906
This file contains hidden or 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: Build Docker Images | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - Dockerfile | |
| - .github/workflows/docker.yml | |
| - cron_entrypoint.sh | |
| # only build without pushing on PRs | |
| pull_request: | |
| paths: | |
| - Dockerfile | |
| - .github/workflows/docker.yml | |
| - cron_entrypoint.sh | |
| workflow_dispatch: | |
| schedule: | |
| - cron: "0 0 * * *" | |
| permissions: | |
| contents: read | |
| # only allow one build at a time per branch | |
| concurrency: | |
| group: ci-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| DO_PUSH: ${{ github.ref == 'refs/heads/main' }} # do not push on PRs | |
| jobs: | |
| images: | |
| timeout-minutes: 500 | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| versions: | |
| - rt: "5.0.8" | |
| rtir: "5.0.8" | |
| - rt: "5.0.9" | |
| rtir: "5.0.8" | |
| create_major: "true" # only enable on the latest version of a major | |
| - rt: "6.0.0" | |
| rtir: "5.0.8" | |
| - rt: "6.0.1" | |
| rtir: "6.0.1" | |
| - rt: "6.0.2" | |
| rtir: "6.0.1" | |
| latest_tag: "true" # point the latest tag to this version | |
| create_major: "true" # only enable on the latest version of a major | |
| steps: | |
| - name: checkout sources | |
| uses: actions/checkout@v6 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| id: buildx | |
| with: | |
| install: true | |
| - name: Docker meta | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: firefart/requesttracker | |
| flavor: | | |
| # disable setting the latest tag by default | |
| latest=false | |
| tags: | | |
| # Enable latest tag if set | |
| type=raw,value=latest,enable=${{ matrix.versions.latest_tag == 'true' }} | |
| # Create a tag for the major version | |
| type=semver,pattern={{major}},value=${{ matrix.versions.rt }},enable=${{ matrix.versions.create_major == 'true' }} | |
| # Create a tag for the full version | |
| type=raw,value=${{ matrix.versions.rt }} | |
| type=schedule,pattern={{date 'YYYYMMDD'}},prefix=nightly-${{ matrix.versions.rt }}- | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3.6.0 | |
| if: env.DO_PUSH == 'true' | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Build and push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| build-args: | | |
| RT_VERSION=${{ matrix.versions.rt }} | |
| RTIR_VERSION=${{ matrix.versions.rtir }} | |
| context: . | |
| file: Dockerfile | |
| platforms: linux/amd64,linux/arm64 | |
| sbom: true | |
| provenance: mode=max | |
| push: ${{ env.DO_PUSH }} | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} |