fix ci timeout #44
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
# This file is part of the sshilko/php-api-myrpc package. | |
# | |
# (c) Sergei Shilko <[email protected]> | |
# | |
# MIT License | |
# | |
# For the full copyright and license information, please view the LICENSE | |
# file that was distributed with this source code. | |
# @license https://opensource.org/licenses/mit-license.php MIT | |
name: Docker | |
on: | |
push: | |
branches: [ "master" ] | |
permissions: | |
contents: read | |
jobs: | |
build-containers: | |
runs-on: ubuntu-latest | |
if: "!contains(github.event.head_commit.message, 'skip-ci')" | |
timeout-minutes: 6 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Cache Docker php-image | |
id: docker-php-image-cache | |
uses: actions/cache@v3 | |
with: | |
path: /tmp/docker-save | |
key: ${{ runner.os }}-docker-php-build-save-${{ hashFiles('/build/Dockerfile.php.common', '/build/dockerfile.php81') }} | |
- name: Load cached Docker image | |
run: docker load -i /tmp/docker-save/snapshot.tar || true | |
if: steps.docker-php-image-cache.outputs.cache-hit == 'true' | |
- name: Build Docker image | |
run: ls -l && docker build -f build/dockerfile.php81 --build-arg BUILDKIT_INLINE_CACHE=1 -t app/php-image --cache-from=app/php-image-cache ./build | |
if: steps.docker-php-image-cache.outputs.cache-hit != 'true' | |
env: | |
DOCKER_BUILDKIT: '1' | |
COMPOSE_DOCKER_CLI_BUILD: '1' | |
- name: Tag Docker image | |
run: docker tag app/php-image app/php-image-cache && mkdir -p /tmp/docker-save && docker save app/php-image-cache -o /tmp/docker-save/snapshot.tar && ls -lh /tmp/docker-save || true | |
if: always() && steps.docker-php-image-cache.outputs.cache-hit != 'true' |