Skip to content

Merge pull request #237 from sheril5/main #75

Merge pull request #237 from sheril5/main

Merge pull request #237 from sheril5/main #75

Workflow file for this run

name: Docker Image CI
on:
push:
paths:
- 'images/**'
branches: [ main ]
env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Docker push
run: |
# Log in to GitHub Container Registry
docker login ${{ env.REGISTRY }} -u jebinjeb -p ${{ secrets.GITHUB_TOKEN }}
while IFS= read -r image; do
# Check if the image is from docker.io
docker pull "$image"
# Tag the image with the GitHub repository URL
github_image="ghcr.io/$GITHUB_REPOSITORY/$(echo "$image" | awk -F '/' '{print $NF}')"
docker tag "$image" "$github_image"
# Push the image to GitHub Container Registry
docker push "$github_image"
if [ $? -eq 0 ]; then
echo "Image pushed successfully"
else
echo "retry"
docker push "$github_image"
fi
done < images/capten-images.txt