Skip to content

Commit

Permalink
Using dockerhub and ghcr (#7)
Browse files Browse the repository at this point in the history
# 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
  • Loading branch information
dblane-digicatapult authored Oct 22, 2024
1 parent 5bbadbe commit 503400d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
27 changes: 21 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ jobs:

steps:
- uses: actions/checkout@v4

# Docker build
- name: Setup QEMU
uses: docker/setup-qemu-action@v3
with:
Expand All @@ -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:
Expand All @@ -111,23 +113,33 @@ 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
with:
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: .
Expand All @@ -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 }}
Expand All @@ -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 }}
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"]
readme = "README.md"
Expand Down

0 comments on commit 503400d

Please sign in to comment.