Files
ChatBot/.gitea/workflows/publish-docker.yml
Leonid Pershin e54d44b581
All checks were successful
SonarQube / Build and analyze (pull_request) Successful in 3m27s
Tests / Run Tests (pull_request) Successful in 2m34s
Enhance workflow configurations by adding timeouts for build, publish, and test jobs
2025-10-23 09:14:15 +03:00

50 lines
1.4 KiB
YAML

name: Publish Docker Image
on:
push:
branches:
- master
jobs:
publish:
name: Build and Publish to Harbor
runs-on: ubuntu-latest
timeout-minutes: 15
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 }}"