Skip to content

Update image definition (#47) #18

Update image definition (#47)

Update image definition (#47) #18

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