Skip to content

Add theather module (#218) #825

Add theather module (#218)

Add theather module (#218) #825

name: Build and Publish Docker Images
on:
push:
branches: [main, claims-workflow]
tags:
- '*'
workflow_dispatch:
permissions:
contents: write
packages: write
env:
REGISTRY: ghcr.io
IMAGE_OWNER: ampath
REPO_NAME: o3-amrs
GATEWAY_IMAGE: gateway
FRONTEND_IMAGE: frontend
BACKEND_IMAGE: backend
ODOO_POSTGRES_IMAGE: odoo-postgres
ODOO_IMAGE: odoo
EIP_ODOO_OPENMRS_IMAGE: eip-odoo-openmrs
EIP_ODOO_OPENMRS_AMPATH_IMAGE: eip-odoo-openmrs-ampath
jobs:
build-and-release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Extract short SHA
id: vars
run: echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Set branch image tag
run: |
if [ "${{ github.ref_type }}" = "tag" ] || [ "${{ github.ref_name }}" = "main" ]; then
echo "BRANCH_IMAGE_TAG=latest" >> $GITHUB_ENV
elif [ "${{ github.ref_name }}" = "claims-workflow" ]; then
echo "BRANCH_IMAGE_TAG=claims-workflow" >> $GITHUB_ENV
else
echo "BRANCH_IMAGE_TAG=latest" >> $GITHUB_ENV
fi
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Extract RELEASE_VERSION from pom.xml
id: extract_version
run: |
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Set up JDK 17 and configure Maven for GitHub Packages
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- uses: s4u/maven-settings-action@v3.1.0
with:
servers: |
[{
"id": "github",
"username": "${{ github.actor }}",
"password": "${{ secrets.GITHUB_TOKEN }}"
},
{
"id": "github-ampath-morgue",
"username": "${{ github.actor }}",
"password": "${{ secrets.GITHUB_TOKEN }}"
}]
- name: Build and push gateway image
uses: docker/build-push-action@v6
with:
context: ./gateway
platforms: linux/amd64,linux/arm64
push: true
tags: |
ghcr.io/${{ env.IMAGE_OWNER }}/${{ env.REPO_NAME }}-${{ env.GATEWAY_IMAGE }}:${{ steps.vars.outputs.SHORT_SHA }}
ghcr.io/${{ env.IMAGE_OWNER }}/${{ env.REPO_NAME }}-${{ env.GATEWAY_IMAGE }}:${{ env.BRANCH_IMAGE_TAG }}
ghcr.io/${{ env.IMAGE_OWNER }}/${{ env.REPO_NAME }}-${{ env.GATEWAY_IMAGE }}:${{ env.RELEASE_VERSION }}
- name: Build and push frontend image
uses: docker/build-push-action@v5
with:
context: ./frontend
platforms: linux/amd64,linux/arm64
push: true
tags: |
ghcr.io/${{ env.IMAGE_OWNER }}/${{ env.REPO_NAME }}-${{ env.FRONTEND_IMAGE }}:${{ steps.vars.outputs.SHORT_SHA }}
ghcr.io/${{ env.IMAGE_OWNER }}/${{ env.REPO_NAME }}-${{ env.FRONTEND_IMAGE }}:${{ env.BRANCH_IMAGE_TAG }}
ghcr.io/${{ env.IMAGE_OWNER }}/${{ env.REPO_NAME }}-${{ env.FRONTEND_IMAGE }}:${{ env.RELEASE_VERSION }}
- name: Build and push backend image
uses: docker/build-push-action@v6
env:
BUILDKIT_PROGRESS: plain
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
secret-files: |
m2settings=/home/runner/.m2/settings.xml
tags: |
ghcr.io/${{ env.IMAGE_OWNER }}/${{ env.REPO_NAME }}-${{ env.BACKEND_IMAGE }}:${{ steps.vars.outputs.SHORT_SHA }}
ghcr.io/${{ env.IMAGE_OWNER }}/${{ env.REPO_NAME }}-${{ env.BACKEND_IMAGE }}:${{ env.BRANCH_IMAGE_TAG }}
ghcr.io/${{ env.IMAGE_OWNER }}/${{ env.REPO_NAME }}-${{ env.BACKEND_IMAGE }}:${{ env.RELEASE_VERSION }}
# package: eip-odoo-openmrs-ampath JAR must exist before odoo-docker copies it (not on Central)
- name: Prepare Odoo Docker build context (Ozone distro + configs)
run: mvn -Podoo-docker clean package -Dskip.docker.build=true
- name: Build and push Odoo PostgreSQL image
uses: docker/build-push-action@v6
with:
context: ./odoo-docker/target/odoo-build
file: ./odoo-docker/target/odoo-build/postgresql/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: |
ghcr.io/${{ env.IMAGE_OWNER }}/${{ env.REPO_NAME }}-${{ env.ODOO_POSTGRES_IMAGE }}:${{ steps.vars.outputs.SHORT_SHA }}
ghcr.io/${{ env.IMAGE_OWNER }}/${{ env.REPO_NAME }}-${{ env.ODOO_POSTGRES_IMAGE }}:${{ env.BRANCH_IMAGE_TAG }}
ghcr.io/${{ env.IMAGE_OWNER }}/${{ env.REPO_NAME }}-${{ env.ODOO_POSTGRES_IMAGE }}:${{ env.RELEASE_VERSION }}
- name: Build and push Odoo image
uses: docker/build-push-action@v6
with:
context: ./odoo-docker/target/odoo-build
file: ./odoo-docker/target/odoo-build/odoo/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: |
ghcr.io/${{ env.IMAGE_OWNER }}/${{ env.REPO_NAME }}-${{ env.ODOO_IMAGE }}:${{ steps.vars.outputs.SHORT_SHA }}
ghcr.io/${{ env.IMAGE_OWNER }}/${{ env.REPO_NAME }}-${{ env.ODOO_IMAGE }}:${{ env.BRANCH_IMAGE_TAG }}
ghcr.io/${{ env.IMAGE_OWNER }}/${{ env.REPO_NAME }}-${{ env.ODOO_IMAGE }}:${{ env.RELEASE_VERSION }}
- name: Build and push EIP Odoo–OpenMRS image (stock Ozone JAR)
uses: docker/build-push-action@v6
with:
context: ./odoo-docker/target/odoo-build
file: ./odoo-docker/target/odoo-build/eip-odoo-openmrs/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: |
ghcr.io/${{ env.IMAGE_OWNER }}/${{ env.REPO_NAME }}-${{ env.EIP_ODOO_OPENMRS_IMAGE }}:${{ steps.vars.outputs.SHORT_SHA }}
ghcr.io/${{ env.IMAGE_OWNER }}/${{ env.REPO_NAME }}-${{ env.EIP_ODOO_OPENMRS_IMAGE }}:${{ env.BRANCH_IMAGE_TAG }}
ghcr.io/${{ env.IMAGE_OWNER }}/${{ env.REPO_NAME }}-${{ env.EIP_ODOO_OPENMRS_IMAGE }}:${{ env.RELEASE_VERSION }}
- name: Build and push EIP Odoo–OpenMRS AMPATH image (custom JAR + synthetic ServiceRequest)
uses: docker/build-push-action@v6
with:
context: ./odoo-docker/target/odoo-build
file: ./odoo-docker/target/odoo-build/eip-odoo-openmrs-ampath-image/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: |
ghcr.io/${{ env.IMAGE_OWNER }}/${{ env.REPO_NAME }}-${{ env.EIP_ODOO_OPENMRS_AMPATH_IMAGE }}:${{ steps.vars.outputs.SHORT_SHA }}
ghcr.io/${{ env.IMAGE_OWNER }}/${{ env.REPO_NAME }}-${{ env.EIP_ODOO_OPENMRS_AMPATH_IMAGE }}:${{ env.BRANCH_IMAGE_TAG }}
ghcr.io/${{ env.IMAGE_OWNER }}/${{ env.REPO_NAME }}-${{ env.EIP_ODOO_OPENMRS_AMPATH_IMAGE }}:${{ env.RELEASE_VERSION }}