updated etcd backup image #11
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 | |
on: | |
push: | |
branches: [main] | |
workflow_dispatch: # For manual trigger | |
jobs: | |
generate-matrix: | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Read images.txt and generate matrix | |
id: set-matrix | |
run: | | |
image_dirs=$(cat images.txt | tr '\n' ' ') | |
image_matrix="{\"include\":[" | |
for dir in $image_dirs; do | |
image_matrix+="{\"image_dir\":\"$dir\"}," | |
done | |
image_matrix=${image_matrix%,} | |
image_matrix+="]}" | |
echo "matrix=$image_matrix" | |
echo "matrix=$image_matrix" >> $GITHUB_OUTPUT | |
build-and-push: | |
needs: generate-matrix | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker registry with access token | |
run: | | |
echo "$DOCKER_ACCESS_TOKEN" | docker login -u dave4272t --password-stdin | |
env: | |
DOCKER_ACCESS_TOKEN: ${{ secrets.DOCKER_ACCESS_TOKEN }} | |
- name: Build and push images | |
run: | | |
version=$(cat "./${{ matrix.image_dir }}/VERSION") | |
image_name="corpdk/${{ matrix.image_dir }}" | |
docker buildx build --push --platform "linux/amd64,linux/arm64" -t "$image_name:$version" -t "$image_name:latest" ./${{ matrix.image_dir }} |