refactor: Cleaner Makefile using variable targets #53
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 Images | |
on: | |
push: | |
branches: | |
- develop | |
workflow_dispatch: | |
jobs: | |
build-node: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
node: ["14", "16", "18", "20"] | |
name: node-dev-base ${{ matrix.node }} images | |
steps: | |
- name: Check out the repository | |
uses: actions/checkout@v2 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
with: | |
install: true | |
- name: Login to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build nystudio107/node-dev-base:${{ matrix.node }}-alpine | |
uses: docker/build-push-action@v2 | |
with: | |
context: node-dev-base/${{ matrix.node }}-alpine | |
file: node-dev-base/${{ matrix.node }}-alpine/Dockerfile | |
push: false | |
platforms: linux/amd64,linux/arm64 | |
tags: nystudio107/node-dev-base:${{ matrix.node }}-alpine | |
build-args: | | |
NODE_VERSION=${{ matrix.node }} | |
build-php: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
php: ["7.4", "8.0", "8.1", "8.2"] | |
name: php-dev-base ${{ matrix.php }} images | |
steps: | |
- name: Check out the repository | |
uses: actions/checkout@v2 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
with: | |
install: true | |
- name: Login to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build nystudio107/php-prod-base:${{ matrix.php }}-alpine | |
uses: docker/build-push-action@v2 | |
with: | |
context: php-prod-base/${{ matrix.php }}-alpine | |
file: php-prod-base/${{ matrix.php }}-alpine/Dockerfile | |
push: false | |
platforms: linux/amd64,linux/arm64 | |
tags: nystudio107/php-prod-base:${{ matrix.php }}-alpine | |
build-args: | | |
PHP_VERSION=${{ matrix.php }} | |
- name: Build nystudio107/php-dev-base:${{ matrix.php }}-alpine | |
uses: docker/build-push-action@v2 | |
with: | |
context: php-dev-base/${{ matrix.php }}-alpine | |
file: php-dev-base/${{ matrix.php }}-alpine/Dockerfile | |
push: false | |
platforms: linux/amd64,linux/arm64 | |
tags: nystudio107/php-dev-base:${{ matrix.php }}-alpine | |
build-args: | | |
PHP_VERSION=${{ matrix.php }} |