Merge pull request #36 from cron-eu/php-fpm-customization #45
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 | |
jobs: | |
build_fpm: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- php-version: "8.2" | |
- php-version: "8.1" | |
- php-version: "7.4" | |
- php-version: "7.3" | |
- php-version: "7.2" | |
- php-version: "7.0" | |
steps: | |
- name: "Checkout Sourcecode" | |
uses: actions/checkout@v2 | |
- name: "Set up Docker Buildx" | |
id: builder | |
uses: docker/setup-buildx-action@v1 | |
- 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: "Cache Docker layers" | |
uses: actions/cache@v2 | |
with: | |
path: .buildx-cache | |
key: buildx-${{ matrix.php-version }}-${{ github.sha }} | |
restore-keys: | | |
buildx-${{ matrix.php-version }}-${{ github.sha }} | |
buildx-${{ matrix.php-version }} | |
buildx | |
- name: "Docker build php-${{ matrix.php-version }}" | |
run: | | |
make build-fpm \ | |
PHP_VERSION=${{ matrix.php-version }} \ | |
DOCKER_CACHE_PATH=.buildx-cache | |
- name: "Login to DockerHub" | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: "Docker push php-${{ matrix.php-version }}" | |
run: | | |
make build-fpm \ | |
PHP_VERSION=${{ matrix.php-version }} \ | |
DOCKER_CACHE_PATH=.buildx-cache \ | |
BUILDX_OPTIONS=--push | |
- name: "Upload artefacts for our next job to use" | |
uses: actions/upload-artifact@v2 | |
with: | |
name: buildx-${{ matrix.php-version }}-${{ github.sha }} | |
path: .buildx-cache | |
- name: "Update Docker Hub Description (croneu/phpapp-fpm)" | |
uses: peter-evans/dockerhub-description@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
# Note: the "TOKEN" does not work for the docker hub API yet, see | |
# https://github.com/peter-evans/dockerhub-description/issues/10 | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
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.2" | |
node-version: "18" | |
- php-version: "8.1" | |
node-version: "16" | |
- php-version: "7.4" | |
node-version: "16" | |
- php-version: "7.4" | |
node-version: "14" | |
- php-version: "7.4" | |
node-version: "12" | |
- php-version: "7.4" | |
node-version: "10" | |
- php-version: "7.3" | |
node-version: "10" | |
- php-version: "7.2" | |
node-version: "10" | |
- php-version: "7.0" | |
node-version: "14" | |
steps: | |
- name: "Checkout Sourcecode" | |
uses: actions/checkout@v2 | |
- name: "Set up Docker Buildx" | |
id: builder | |
uses: docker/setup-buildx-action@v1 | |
- 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: "Download already created docker layers" | |
uses: actions/download-artifact@v2 | |
with: | |
name: buildx-${{ matrix.php-version }}-${{ github.sha }} | |
path: .buildx-cache | |
- name: "Docker build php-${{ matrix.php-version }} node-${{ matrix.node-version }}" | |
run: | | |
make build-ssh \ | |
PHP_VERSION=${{ matrix.php-version }} NODE_VERSION=${{ matrix.node-version }} \ | |
DOCKER_CACHE_PATH=.buildx-cache | |
- name: "Login to DockerHub" | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: "Docker push php-${{ matrix.php-version }} node-${{ matrix.node-version }}" | |
run: | | |
make build-ssh \ | |
PHP_VERSION=${{ matrix.php-version }} NODE_VERSION=${{ matrix.node-version }} \ | |
DOCKER_CACHE_PATH=.buildx-cache \ | |
BUILDX_OPTIONS=--push | |
- name: "Update Docker Hub Description (croneu/phpapp-ssh)" | |
uses: peter-evans/dockerhub-description@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
# Note: the "TOKEN" does not work for the docker hub API yet, see | |
# https://github.com/peter-evans/dockerhub-description/issues/10 | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
repository: croneu/phpapp-ssh | |
short-description: ${{ github.event.repository.description }} - SSH |