Added matrix build for both Alpine and Debian images. #19
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 Docker image | |
on: | |
push: | |
workflow_dispatch: | |
env: | |
registry: ghcr.io | |
jobs: | |
Build_image: | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
strategy: | |
matrix: | |
distro: | |
- Alpine | |
- Debian | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Log in to the container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.registry }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Declare image name | |
run: image=${GITHUB_REPOSITORY,,} && echo image=${image%-*} | tee -a "$GITHUB_ENV" | |
- name: Build Docker image (${{ matrix.distro }}) | |
run: docker build --tag ${tag=${{ env.registry }}/${{ env.image }}:${distro,,}} - <$distro.Dockerfile | |
&& <<<tag=$tag tee -a "$GITHUB_ENV" | |
env: | |
distro: ${{ matrix.distro }} | |
- name: Push Docker image (${{ env.tag }}) | |
run: docker push ${{ env.tag }} |