Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 0 additions & 44 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,50 +16,6 @@ jobs:
name: Check code is formatted with ktlint
uses: ./.github/workflows/ktlint.yml

publish_docker_image_to_docker_hub:
needs:
- run_unit_tests
- check_code_formatting
name: Build & Push docker image to dockerhub
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Extract metadata to env variables
uses: HSLdevcom/jore4-tools/github-actions/extract-metadata@extract-metadata-v1

- name: Pull previous image to support caching
run: docker pull $IMAGE_NAME:builder || echo "Previous builder image not found"

- name: Build dependencies & source code into builder image to support caching
run: docker build --cache-from=$IMAGE_NAME:builder --target builder -t $IMAGE_NAME:builder .

- name: Build docker image for distribution
run: docker build --cache-from=$IMAGE_NAME:builder --cache-from=$IMAGE_NAME:latest -t $IMAGE_NAME:dev --build-arg NEXT_PUBLIC_GIT_HASH=$GITHUB_SHA .

- name: Tag docker image as 'latest'
if: ${{ github.ref == 'refs/heads/main' }}
run: docker tag $IMAGE_NAME:dev $IMAGE_NAME:latest

- name: Tag docker image as '<branch_name>-<git_commit_sha>'
run: docker tag $IMAGE_NAME:dev $IMAGE_NAME:$COMMIT_ID

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.JORE4_DOCKERHUB_USER }}
password: ${{ secrets.JORE4_DOCKERHUB_TOKEN }}

- name: Push image tagged with git commit details to Docker Hub
run: docker push $IMAGE_NAME:$COMMIT_ID

- name: Push rest of the tags to Docker Hub
if: ${{ github.ref == 'refs/heads/main' }}
run: |
docker push $IMAGE_NAME:builder
docker push $IMAGE_NAME:latest

publish_docker_image_to_acr:
needs:
- run_unit_tests
Expand Down
Loading