Skip to content

Commit

Permalink
Create licensed_image_build_community.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthiasHertel80 committed Jan 15, 2024
1 parent 3cb43cd commit e836cf3
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/licensed_image_build_community.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# This YAML file is used to build and push a custom Docker image with the necessary tools and dependencies for an ML project
# It contains a job that builds the Docker image and pushes it to GitHub Container Registry

name: Licensed Docker Image (Community Edition) - Build and Push

on:
# Trigger the workflow when a workflow run is completed
workflow_run:
workflows: ["Base Docker Image (Community Edition) - Build and Push"]
types:
- completed
# Trigger the workflow nightly
schedule:
- cron: '0 0 * * *'
# Trigger the workflow manually
workflow_dispatch:


jobs:
build_and_push:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
# Check out the repository containing the Dockerfile and other necessary files
uses: actions/checkout@v2

- name: Log in to GitHub Container Registry
# Log in to GitHub Container Registry using the actor and a GitHub token
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Format repo slug
# Format the repository slug to lowercase for use in the Docker image tags
id: repo_slug
run: echo "REPO_SLUG=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV

- name: Pull Base Docker image
# Pull the base Docker image from GitHub Container Registry
run: docker pull ghcr.io/${{ env.REPO_SLUG }}/arm-mlops-docker-base:latest

- name: Create license file (stub)
# Create a license file for the Docker image using the ARM UBL license identifier
run:
# docker run -d --name build_container -u root -v ${{ github.workspace }}:/workspace ghcr.io/${{ env.REPO_SLUG }}/arm-mlops-docker-base:latest sleep infinity
echo "Secret is not set. Building with Community Edition license. Non commercial use only."

- name: Build and push Docker image
# Build the Docker image using the Dockerfile in the `docker_licensed` directory and push it to GitHub Container Registry
uses: docker/build-push-action@v2
with:
context: ./docker_licensed
push: true
build-args: |
BASE_IMAGE=ghcr.io/${{ env.REPO_SLUG }}/arm-mlops-docker-base:latest
tags: ghcr.io/${{ env.REPO_SLUG }}/arm-mlops-docker-licensed-community:latest

0 comments on commit e836cf3

Please sign in to comment.