fix: ci #1
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: Docker Image Build & Push | |
on: | |
push: | |
branches: | |
- main | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Log in to the Container registry | |
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Get Dockerfiles | |
id: files | |
run: | | |
echo "::set-output name=dockerfiles::$(find . -type f -name Dockerfile)" | |
shell: bash | |
- name: Build and push Docker images | |
run: | | |
for dockerfile in ${{ steps.files.outputs.dockerfiles }} | |
do | |
relative_path=$(realpath --relative-to=./jupyter $dockerfile) | |
framework=$(dirname $relative_path | cut -d'/' -f1) | |
version=$(basename $(dirname $relative_path)) | |
echo "Processing Dockerfile for framework $framework version $version..." | |
# Extract the directory containing the Dockerfile to use as build context | |
context_dir=$(dirname $dockerfile) | |
docker build -f $dockerfile -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${framework}-${version} $context_dir | |
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${framework}-${version} | |
done | |
shell: bash |