| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- name: Build PHP
- on:
- # push:
- # branches: [ master ]
- # paths:
- # - 'php/**'
- # - '.github/workflows/build-php.yml'
- # UTC +8
- # schedule:
- # - cron: "0 20 * * *"
- # pull_request:
- # branches: [ master ]
- workflow_dispatch:
- jobs:
- build-php:
- runs-on: ubuntu-latest
- steps:
- - name: Check Out Repo
- uses: actions/checkout@v3
- - name: Set up Docker Buildx
- uses: docker/setup-buildx-action@v2
- id: buildx
- - name: Cache Docker layers
- uses: actions/cache@v3
- with:
- path: /tmp/.buildx-cache
- key: ${{ runner.os }}-buildx-${{ github.sha }}
- restore-keys: |
- ${{ runner.os }}-buildx-
- - name: Login to Docker Hub
- uses: docker/login-action@v2
- with:
- username: ${{ secrets.DOCKER_HUB_USERNAME }}
- password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- - name: Build and push Docker images
- uses: docker/build-push-action@v3
- id: docker_build_php_core
- with:
- context: ./php
- file: ./php/Dockerfile
- push: true
- tags: |
- ${{ secrets.DOCKER_HUB_USERNAME }}/php:latest
- ${{ secrets.DOCKER_HUB_USERNAME }}/php:7.4-fpm-alpine
- builder: ${{ steps.buildx.outputs.name }}
- cache-from: type=local,src=/tmp/.buildx-cache
- cache-to: type=local,dest=/tmp/.buildx-cache-new
- - name: Build and push Docker images
- uses: docker/build-push-action@v3
- id: docker_build_php
- with:
- context: ./php
- file: ./php/Dockerfile.latest
- push: true
- tags: |
- ${{ secrets.DOCKER_HUB_USERNAME }}/php:7.4
- builder: ${{ steps.buildx.outputs.name }}
- cache-from: type=local,src=/tmp/.buildx-cache
- cache-to: type=local,dest=/tmp/.buildx-cache-new
- - name: Move cache
- run: |
- rm -rf /tmp/.buildx-cache
- mv /tmp/.buildx-cache-new /tmp/.buildx-cache
- - name: Image digest
- run: |
- echo ${{ steps.docker_build_php_core.outputs.digest }}
- echo ${{ steps.docker_build_php.outputs.digest }}
|