[v0.97.0] Docker Image Build and Push (Production) #238
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Unstract Docker Image Build and Push (Production) | |
on: | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: "Docker image tag" | |
required: true | |
release: | |
types: | |
- created | |
run-name: "[${{ github.event.release.tag_name || github.event.inputs.tag }}] Docker Image Build and Push (Production)" | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
service_name: [backend, frontend, platform-service, prompt-service, worker, x2text-service] | |
steps: | |
- name: Checkout code for release | |
if: github.event_name == 'release' | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.release.tag_name }} | |
- name: Checkout code for branch | |
if: github.event_name != 'release' | |
uses: actions/checkout@v4 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push images | |
working-directory: ./docker | |
run: | | |
DOCKER_VERSION_TAG=${{ github.event.release.tag_name || github.event.inputs.tag}} | |
VERSION=$DOCKER_VERSION_TAG docker compose -f docker-compose.build.yaml build --no-cache ${{ matrix.service_name }} | |
docker push unstract/${{ matrix.service_name }}:$DOCKER_VERSION_TAG | |
if [ "${{ github.event_name }}" = "release" ]; then | |
echo "This workflow was triggered by a release event." | |
docker tag unstract/${{ matrix.service_name }}:$DOCKER_VERSION_TAG unstract/${{ matrix.service_name }}:latest | |
docker push unstract/${{ matrix.service_name }}:latest | |
fi |