Skip to content

docs(medcat): CU-869avu9pv Fix docs (#180) #548

docs(medcat): CU-869avu9pv Fix docs (#180)

docs(medcat): CU-869avu9pv Fix docs (#180) #548

name: medcat-service - Build Images
on:
push:
branches: [ main ]
tags:
- 'medcat-service/v*.*.*' # e.g., medcat-serice/v0.1.1
pull_request:
paths:
- 'medcat-v2/**'
- 'medcat-service/**'
- '.github/workflows/medcat-service**'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
defaults:
run:
working-directory: ./medcat-service
jobs:
build:
if: github.event.pull_request.user.login != 'dependabot[bot]' && github.repository == 'CogStack/cogstack-nlp'
runs-on: ubuntu-latest
outputs:
image_version: ${{ steps.meta.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Extract metadata (tags, labels) for Docker MedCATservice
id: meta
uses: docker/metadata-action@v5
with:
images: cogstacksystems/medcat-service
tags: |
# set latest tag for default branch
type=raw,value=latest,enable={{is_default_branch}}
# Include all default tags
type=schedule
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
type=sha
# Create version tag based on tag prefix
type=match,pattern=medcat-service/v(\d+\.\d+\.\d+),group=1
flavor: latest=false
- name: Make medact-v2 available within build
run: cp -r ../medcat-v2 medcat-v2
- name: Build and push Docker MedCATservice image
id: docker_build
uses: docker/build-push-action@v6
with:
context: ./medcat-service/
push: true
allow: network.host
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=cogstacksystems/medcat-service:buildcache
cache-to: type=registry,ref=cogstacksystems/medcat-service:buildcache,mode=max
build-args: |
REINSTALL_CORE_FROM_LOCAL=true
- name: Extract metadata (tags, labels) for Docker MedCATservice-gpu
id: meta-gpu
uses: docker/metadata-action@v5
with:
images: cogstacksystems/medcat-service-gpu
tags: |
# set latest tag for default branch
type=raw,value=latest,enable={{is_default_branch}}
# Include all default tags
type=schedule
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
type=sha
# Create version tag based on tag prefix
type=match,pattern=medcat-service/v(\d+\.\d+\.\d+),group=1
flavor: latest=false
build-args: |
REINSTALL_CORE_FROM_LOCAL=true
- name: Build and push Docker Jupyter singleuser image with GPU support
id: docker_build_gpu
uses: docker/build-push-action@v6
with:
context: ./medcat-service/
file : "./medcat-service/Dockerfile_gpu"
allow: network.host
tags: ${{ steps.meta-gpu.outputs.tags }}
labels: ${{ steps.meta-gpu.outputs.labels }}
push: true
cache-from: type=registry,ref=cogstacksystems/medcat-service-gpu:buildcache
cache-to: type=registry,ref=cogstacksystems/medcat-service-gpu:buildcache,mode=max
build-args: |
REINSTALL_CORE_FROM_LOCAL=true
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
working-directory: "./"
integration_test:
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
variant: [v1, v2, DeID]
steps:
- name: Check out code
uses: actions/checkout@v5
- name: Run Test with example model pack
run: |
echo "🧪 Running Examples test..."
export IMAGE_TAG=${{ needs.build.outputs.image_version }} # Improve by running exact digest instead
echo "Running with image tag ${IMAGE_TAG} and variant ${{ matrix.variant }}"
bash scripts/test_examples.sh ${{ matrix.variant }}
- name: Report test result
if: always()
run: |
if [ $? -eq 0 ]; then
echo "✅ Integration test PASSED"
else
echo "❌ Integration test FAILED"
exit 1
fi