build docker image on github #3
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: Publish OpenMRS Backend docker image | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main_icrc | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: openmrs-appointments | |
IMAGE_VERSION: 0.04 | |
CONTEXT: . | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- uses: actions/checkout@v4 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
${{ env.REGISTRY }}/${{ github.repository }}/${{ env.IMAGE_NAME }} | |
tags: | | |
type=sha,prefix=${{ env.IMAGE_VERSION }}- | |
- name: Build and push Backend Docker image | |
uses: docker/build-push-action@v6 | |
with: | |
context: ${{ env.CONTEXT }} | |
push: true | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |