From 503400d35775c381fdfe42cf11d332335417bb1c Mon Sep 17 00:00:00 2001 From: David Blane <32327139+dblane-digicatapult@users.noreply.github.com> Date: Tue, 22 Oct 2024 11:57:12 +0100 Subject: [PATCH] Using dockerhub and ghcr (#7) # Pull Request ## Checklist - [X] Have you read Digital Catapult's [Code of Conduct](https://github.com/digicatapult/.github/blob/main/CODE_OF_CONDUCT.md)? - [X] I have performed a self-review of my own code. - [X] I have commented my code, particularly in hard-to-understand areas. - [X] I have made corresponding changes to the documentation. - [ ] My changes generate no new warnings. - [ ] I have added tests that prove my fix is effective or that my feature works. - [ ] New and existing unit tests pass locally with my changes. ## PR Type Please delete options that are irrelevant. - [X] Chore ## Linked tickets N/A ## High level description Adds ability to push to dockerhub ## Detailed description Alters the publish step so that we release container artifacts to dockerhub as well as GHCR so people can pull without requiring GHCR authentication. ## Describe alternatives you've considered N/A ## Operational impact N/A ## Additional context N/A --- .github/workflows/release.yml | 27 +++++++++++++++++++++------ pyproject.toml | 2 +- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 91730fa..c94a9ed 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -90,6 +90,8 @@ jobs: steps: - uses: actions/checkout@v4 + + # Docker build - name: Setup QEMU uses: docker/setup-qemu-action@v3 with: @@ -98,7 +100,7 @@ jobs: id: buildx uses: docker/setup-buildx-action@v3 with: - buildkitd-flags: "--debug" + buildkitd-flags: '--debug' - name: Generate tags id: generate-tags env: @@ -111,14 +113,19 @@ jobs: run: | if [ "$IS_NEW_VERSION" == "true" ]; then echo "GHCR_VERSION_TAG=ghcr.io/${{ needs.preconditions.outputs.org_name }}/${{ needs.preconditions.outputs.repo_name }}:$VERSION" >> $GITHUB_OUTPUT + echo "DOCKERHUB_VERSION_TAG=${{ needs.preconditions.outputs.org_name }}/${{ needs.preconditions.outputs.repo_name }}:$VERSION" >> $GITHUB_OUTPUT if [ "$IS_PRERELEASE" == "false" ]; then echo "GHCR_LATEST_TAG=ghcr.io/${{ needs.preconditions.outputs.org_name }}/${{ needs.preconditions.outputs.repo_name }}:latest" >> $GITHUB_OUTPUT + echo "DOCKERHUB_LATEST_TAG=${{ needs.preconditions.outputs.org_name }}/${{ needs.preconditions.outputs.repo_name }}:latest" >> $GITHUB_OUTPUT else echo "GHCR_LATEST_TAG=" >> $GITHUB_OUTPUT + echo "DOCKERHUB_LATEST_TAG=" >> $GITHUB_OUTPUT fi; else echo "GHCR_VERSION_TAG=" >> $GITHUB_OUTPUT echo "GHCR_LATEST_TAG=" >> $GITHUB_OUTPUT + echo "DOCKERHUB_VERSION_TAG=" >> $GITHUB_OUTPUT + echo "DOCKERHUB_LATEST_TAG=" >> $GITHUB_OUTPUT fi; - name: Login to GitHub Container Registry uses: docker/login-action@v3 @@ -126,8 +133,13 @@ jobs: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Login to Dockerhub Registry + uses: docker/login-action@v3 + with: + username: ${{ secrets.BRIDGEAI_DOCKERHUB_USERNAME }} + password: ${{ secrets.BRIDGEAI_DOCKERHUB_TOKEN }} - name: Build image - uses: docker/build-push-action@v5 + uses: docker/build-push-action@v6 with: builder: ${{ steps.buildx.outputs.name }} context: . @@ -138,6 +150,9 @@ jobs: ghcr.io/${{ needs.preconditions.outputs.org_name }}/${{ needs.preconditions.outputs.repo_name }}:${{ github.sha }} ${{ steps.generate-tags.outputs.GHCR_VERSION_TAG }} ${{ steps.generate-tags.outputs.GHCR_LATEST_TAG }} + ${{ needs.preconditions.outputs.org_name }}/${{ needs.preconditions.outputs.repo_name }}:${{ github.sha }} + ${{ steps.generate-tags.outputs.DOCKERHUB_VERSION_TAG }} + ${{ steps.generate-tags.outputs.DOCKERHUB_LATEST_TAG }} labels: | org.opencontainers.image.title=${{ needs.preconditions.outputs.repo_name }} org.opencontainers.image.description=${{ github.event.repository.description }} @@ -149,16 +164,16 @@ jobs: # Build github release - name: Build release version - uses: "marvinpinto/action-automatic-releases@latest" + uses: 'marvinpinto/action-automatic-releases@latest' with: - repo_token: "${{ secrets.GITHUB_TOKEN }}" + repo_token: '${{ secrets.GITHUB_TOKEN }}' automatic_release_tag: ${{ needs.check-version.outputs.version }} prerelease: false title: Release ${{ needs.check-version.outputs.version }} - name: Build release latest - uses: "marvinpinto/action-automatic-releases@latest" + uses: 'marvinpinto/action-automatic-releases@latest' with: - repo_token: "${{ secrets.GITHUB_TOKEN }}" + repo_token: '${{ secrets.GITHUB_TOKEN }}' automatic_release_tag: latest prerelease: false title: Latest Release ${{ needs.check-version.outputs.version }} \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 2bc85da..ac143c8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "bridgeai-regression-model-data-ingestion" -version = "0.1.4" +version = "0.2.0" description = "Data ingestion module for the house price regression model" authors = ["DC AI Team "] readme = "README.md"