Merge pull request #26 from RunOnFlux/develop #55
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: Push Docker Hub Images | |
on: | |
push: | |
branches: | |
- master | |
env: | |
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Login to Docker Hub | |
run: echo $DOCKER_PASSWORD | docker login -u $DOCKER_USERNAME --password-stdin | |
- name: Build and push Docker images | |
run: | | |
mapfile -t json_array < <(jq -r '.[] | .name + " " + .tag' versions.json) | |
for element in "${json_array[@]}"; do | |
name=$(echo "$element" | cut -d ' ' -f 1) | |
tag=$(echo "$element" | cut -d ' ' -f 2) | |
echo "pushing >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> $name" | |
docker build -t runonflux/wp-nginx:$name --build-arg BASE_IMAGE=wordpress:$tag . | |
docker push runonflux/wp-nginx:$name | |
done |