hexabot/.github/workflows/docker.yml

93 lines
2.5 KiB
YAML
Raw Normal View History

2024-09-20 17:59:00 +00:00
name: Build and Push Docker Images
2024-09-19 10:25:09 +00:00
2024-09-18 11:25:56 +00:00
on:
push:
2024-09-20 16:00:52 +00:00
branches: ["main"]
2024-09-18 11:25:56 +00:00
workflow_dispatch:
jobs:
paths-filter:
runs-on: ubuntu-latest
outputs:
frontend: ${{ steps.filter.outputs.frontend }}
api: ${{ steps.filter.outputs.api }}
widget: ${{ steps.filter.outputs.widget }}
2024-09-20 16:00:52 +00:00
nlu: ${{ steps.filter.outputs.nlu }}
2024-09-18 11:25:56 +00:00
steps:
- uses: actions/checkout@v4
- name: Filter paths
id: filter
uses: dorny/paths-filter@v3
with:
filters: |
frontend:
- 'frontend/**'
2024-09-19 10:25:09 +00:00
api:
2024-09-18 11:25:56 +00:00
- 'api/**'
widget:
- 'widget/**'
2024-09-20 16:00:52 +00:00
nlu:
- 'nlu/**'
2024-09-18 11:25:56 +00:00
2024-09-19 10:25:09 +00:00
build-and-push:
2024-09-18 11:25:56 +00:00
runs-on: ubuntu-latest
2024-09-19 10:25:09 +00:00
needs:
- paths-filter
2024-09-18 11:25:56 +00:00
steps:
2024-09-19 10:25:09 +00:00
- name: Check out repository code
2024-09-18 11:25:56 +00:00
uses: actions/checkout@v4
2024-09-19 10:25:09 +00:00
2024-09-18 11:25:56 +00:00
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
2024-09-20 16:00:52 +00:00
2024-09-18 11:25:56 +00:00
- name: Login to Docker Hub
2024-09-19 10:25:09 +00:00
id: docker_login
uses: docker/login-action@v2
2024-09-18 11:25:56 +00:00
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
2024-09-20 16:00:52 +00:00
- name: Build and push Frontend Docker image
2024-09-19 10:25:09 +00:00
if: ${{ needs.paths-filter.outputs.frontend == 'true' }}
2024-09-18 11:25:56 +00:00
uses: docker/build-push-action@v6
with:
2024-09-19 10:25:09 +00:00
context: ./
file: ./frontend/Dockerfile
2024-09-18 11:25:56 +00:00
platforms: linux/amd64,linux/arm64
push: true
2024-09-20 16:00:52 +00:00
tags: hexastack/hexabot-ui:latest
2024-09-18 11:25:56 +00:00
2024-09-19 10:25:09 +00:00
- name: Build and push API Docker image
if: ${{ needs.paths-filter.outputs.api == 'true' }}
2024-09-18 11:25:56 +00:00
uses: docker/build-push-action@v6
with:
2024-09-20 16:00:52 +00:00
context: ./api/
2024-09-19 10:25:09 +00:00
file: ./api/Dockerfile
2024-09-18 11:25:56 +00:00
platforms: linux/amd64,linux/arm64
push: true
2024-09-20 16:00:52 +00:00
tags: hexastack/hexabot-api:latest
2024-09-18 11:25:56 +00:00
2024-09-20 16:00:52 +00:00
- name: Build and push Widget Docker image
2024-09-19 10:25:09 +00:00
if: ${{ needs.paths-filter.outputs.widget == 'true' }}
2024-09-18 11:25:56 +00:00
uses: docker/build-push-action@v6
with:
2024-09-20 16:00:52 +00:00
context: ./widget/
2024-09-19 10:25:09 +00:00
file: ./widget/Dockerfile
2024-09-18 11:25:56 +00:00
platforms: linux/amd64,linux/arm64
2024-09-23 16:12:29 +00:00
target: production
2024-09-18 11:25:56 +00:00
push: true
2024-09-20 16:00:52 +00:00
tags: hexastack/hexabot-widget:latest
- name: Build and push NLU Docker image
if: ${{ needs.paths-filter.outputs.nlu == 'true' }}
uses: docker/build-push-action@v6
with:
context: ./nlu/
file: ./nlu/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: hexastack/hexabot-nlu:latest