-
-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (42 loc) · 1.72 KB
/
phpdocker.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# 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: 10
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'