3. Build and Publish Docker #18
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: 3. Build and Publish Docker | |
| on: | |
| workflow_run: | |
| workflows: ["2. Build and Publish Python"] | |
| types: | |
| - completed | |
| branches: | |
| - main | |
| push: | |
| tags: | |
| - "v*.*.*-*" | |
| env: | |
| _VERSION: 7.3.0-250215 | |
| jobs: | |
| build_publish: | |
| name: Build and Publish Docker | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| contents: read | |
| actions: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| ref: main | |
| - name: Get latest version | |
| id: version | |
| run: | | |
| git fetch --all --tags | |
| git pull origin main | |
| VERSION=$(./scripts/get-version.sh -d) | |
| echo "VERSION=${VERSION}" >> ${GITHUB_ENV} | |
| echo "version=${VERSION}" >> ${GITHUB_OUTPUT} | |
| echo "🐳 Building Docker version: v${VERSION}" | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| with: | |
| image: tonistiigi/binfmt:qemu-v7.0.0-28 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Build and test | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| build-args: | | |
| HASH_PASSWORD=${{ secrets.DOCKER_UID_HASH_PASSWORD }} | |
| load: true | |
| cache-from: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/dev_fingerprinter:cache-latest | |
| tags: ${{ secrets.DOCKERHUB_USERNAME }}/dev_fingerprinter:test | |
| - name: Build and push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| build-args: | | |
| HASH_PASSWORD=${{ secrets.DOCKER_UID_HASH_PASSWORD }} | |
| platforms: linux/amd64 | |
| cache-from: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/dev_fingerprinter:cache-latest | |
| cache-to: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/dev_fingerprinter:cache-latest,mode=max | |
| tags: | | |
| ${{ secrets.DOCKERHUB_USERNAME }}/dev_fingerprinter:latest | |
| ${{ secrets.DOCKERHUB_USERNAME }}/dev_fingerprinter:v${{ env.VERSION }} | |
| push: true | |
| - name: Summary | |
| run: | | |
| echo "### ✅ Docker Image Published" >> $GITHUB_STEP_SUMMARY | |
| echo "**Version:** v${{ env.VERSION }}" >> $GITHUB_STEP_SUMMARY | |
| echo "**Tags:**" >> $GITHUB_STEP_SUMMARY | |
| echo "- \`latest\`" >> $GITHUB_STEP_SUMMARY | |
| echo "- \`v${{ env.VERSION }}\`" >> $GITHUB_STEP_SUMMARY | |
| echo "- \`${{ env.VERSION }}\`" >> $GITHUB_STEP_SUMMARY |