Merge pull request 'add docker pub' (#5) from dev into master
Some checks failed
SonarQube / Build and analyze (push) Successful in 3m2s
Publish Docker Image / Build and Publish to Harbor (push) Failing after 2m11s
Tests / Run Tests (push) Successful in 2m26s

Reviewed-on: #5
This commit was merged in pull request #5.
This commit is contained in:
2025-10-22 04:15:55 +00:00

View File

@@ -0,0 +1,48 @@
name: Publish Docker Image
on:
push:
branches:
- master
jobs:
publish:
name: Build and Publish to Harbor
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Harbor
uses: docker/login-action@v3
with:
registry: harbor.home
username: robot$chatbot
password: ${{ secrets.HARBOR_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: harbor.home/chatbot/chatbot
tags: |
type=ref,event=branch
type=sha,prefix={{branch}}-
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: ./ChatBot
file: ./ChatBot/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=harbor.home/chatbot/chatbot:buildcache
cache-to: type=registry,ref=harbor.home/chatbot/chatbot:buildcache,mode=max
- name: Image digest
run: echo "Image published with digest ${{ steps.build.outputs.digest }}"