Skip to content

Build & push docker container for the eligibilty model 🚀 #21

Build & push docker container for the eligibilty model 🚀

Build & push docker container for the eligibilty model 🚀 #21

name: eligibilty model container build process
run-name: Build & push docker container for the eligibilty model 🚀
on: [push]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
IMAGE_TAG: ${{ github.run_number }}
USERNAME: ${{ github.actor }}
jobs:
Build-Eligibility-Model-Container:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Log in to the Github container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ env.USERNAME }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
# dynamically set the branch name and sha as a custom tag
type=raw,value=eligibility_model-{{branch}}-{{sha}}-pattern={{date 'YYYYMMDD-hhmmss' tz='Asia/Tokyo'}}
- name: List files in the repository
run: |
ls ${{ github.workspace }}
- name: Build and push Docker image
id: push
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
file: ./eligibility_model/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# This step uses the docker/build-push-action action to build the image, based on your repository's Dockerfile.
# If the build succeeds, it pushes the image to GitHub Packages. It uses the context parameter to define the build's context as the set of files located in the specified path.
# For more information, see "Usage" in the README of the docker/build-push-action repository.
# It uses the tags and labels parameters to tag and label the image with the output from the "meta" step.
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true
- run: echo "🍏 This job's status is ${{ job.status }}."