diff --git a/.github/workflows/licensed_image_build_community.yml b/.github/workflows/licensed_image_build_community.yml new file mode 100644 index 0000000..dec3e87 --- /dev/null +++ b/.github/workflows/licensed_image_build_community.yml @@ -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