Add ImageSpec to wine classification example (#48) #21
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: Build and Push Docker Images to GitHub Container Registry when pushed to main | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build_and_publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v2 | |
- name: Log in to GitHub Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ secrets.FLYTE_BOT_USERNAME }} | |
password: ${{ secrets.FLYTE_BOT_PAT }} | |
- name: Iterate through top level directories and build Docker images | |
run: | | |
for dir in *; do | |
if [ -f "$dir/{{cookiecutter.project_name}}/Dockerfile" ]; then | |
echo "Building and pushing Docker image for $dir" | |
docker build -f $dir/{{cookiecutter.project_name}}/Dockerfile -t ghcr.io/${{ github.repository }}:${dir}-latest $dir/{{cookiecutter.project_name}} | |
docker tag ghcr.io/${{ github.repository }}:${dir}-latest ghcr.io/${{ github.repository }}:${dir}-${{ github.sha }} | |
docker push ghcr.io/${{ github.repository }}:${dir}-latest | |
docker push ghcr.io/${{ github.repository }}:${dir}-${{ github.sha }} | |
else | |
echo "Skipping $dir as it does not contain a Dockerfile" | |
fi | |
done |