Deploy Image to DockerHub #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: "Deploy Image to DockerHub" | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
env: | |
PLATFORMS: linux/arm64/v8,linux/amd64 | |
jobs: | |
build_fpm: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- php-version: "8.3" | |
- php-version: "8.2" | |
- php-version: "8.1" | |
steps: | |
- name: "Checkout Sourcecode" | |
uses: actions/checkout@v3 | |
- name: "Set up Docker Buildx" | |
id: builder | |
uses: docker/setup-buildx-action@v2 | |
- name: "Append ARM buildx builder from AWS" | |
uses: baschny/append-buildx-action@v1 | |
with: | |
builder: ${{ steps.builder.outputs.name }} | |
node_name: arm-${{ matrix.php-version }}-${{ matrix.node-version }}-${{ github.sha }} | |
endpoint: "ssh://[email protected]" | |
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }} | |
- name: "Login to DockerHub" | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: "Docker build and push (fpm image)" | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
tags: "croneu/phpapp-fpm:php-${{ matrix.php-version }}" | |
platforms: ${{ env.PLATFORMS }} | |
push: true | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
target: php-fpm | |
build-args: | | |
PHP_MINOR_VERSION=${{ matrix.php-version }} | |
- name: "Update Docker Hub Description (croneu/phpapp-fpm)" | |
uses: peter-evans/dockerhub-description@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
repository: croneu/phpapp-fpm | |
short-description: ${{ github.event.repository.description }} - PHP-FPM | |
build_ssh: | |
needs: | |
- build_fpm | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- php-version: "8.3" | |
node-version: "20" | |
- php-version: "8.2" | |
node-version: "18" | |
- php-version: "8.1" | |
node-version: "16" | |
steps: | |
- name: "Checkout Sourcecode" | |
uses: actions/checkout@v3 | |
- name: "Set up Docker Buildx" | |
id: builder | |
uses: docker/setup-buildx-action@v2 | |
- name: "Append ARM buildx builder from AWS" | |
uses: baschny/append-buildx-action@v1 | |
with: | |
builder: ${{ steps.builder.outputs.name }} | |
node_name: arm-${{ matrix.php-version }}-${{ matrix.node-version }}-${{ github.sha }} | |
endpoint: "ssh://[email protected]" | |
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }} | |
- name: "Login to DockerHub" | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: "Docker build and push (ssh image)" | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
tags: "croneu/phpapp-ssh:php-${{ matrix.php-version }}-node-${{ matrix.node-version }}" | |
platforms: ${{ env.PLATFORMS }} | |
push: true | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
target: ssh | |
build-args: | | |
PHP_MINOR_VERSION=${{ matrix.php-version }} | |
NODE_VERSION=${{ matrix.node-version }} | |
- name: "Update Docker Hub Description (croneu/phpapp-ssh)" | |
uses: peter-evans/dockerhub-description@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
repository: croneu/phpapp-ssh | |
short-description: ${{ github.event.repository.description }} - SSH |