Skip to content

fix basic imagespec template directory name (#46) #17

fix basic imagespec template directory name (#46)

fix basic imagespec template directory name (#46) #17

Workflow file for this run

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