feature branch to trigger #1
This file contains hidden or 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: Build Docker Images | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
- release | |
- d-mcknight-FEAT_DockerBuildAutomation | |
env: | |
REGISTRY: ghcr.io | |
PLATFORMS: linux/amd64,linux/arm64 | |
jobs: | |
build_and_publish_docker: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
# Clone the repository | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
fetch-depth: 1 | |
# Configure Docker Buildx for cross-platform builds | |
- name: Setup QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Setup Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
# Log into ghcr | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# ml_api image | |
- name: Extract metadata for ml_api | |
uses: docker/metadata-action@v2 | |
id: ml_meta | |
with: | |
images: ${{ env.REGISTRY }}/${{github.repository_owner}}/ml_api | |
tags: | | |
type=ref,event=branch | |
type=raw,value=latest | |
- name: Build and push ml_api Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: ml_api | |
push: true | |
tags: ${{ steps.ml_meta.outputs.tags }} | |
labels: ${{ steps.ml_meta.outputs.labels }} | |
platforms: ${{ env.PLATFORMS }} | |
file: ml_api/Dockerfile | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
# obico_web image | |
- name: Extract metadata for obico_web | |
uses: docker/metadata-action@v2 | |
id: web_meta | |
with: | |
images: ${{ env.REGISTRY }}/${{github.repository_owner}}/obico_web | |
tags: | | |
type=ref,event=branch | |
type=raw,value=latest | |
- name: Build and push obico_web Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.web_meta.outputs.tags }} | |
labels: ${{ steps.web_meta.outputs.labels }} | |
platforms: ${{ env.PLATFORMS }} | |
file: backend/Dockerfile | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |