-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (87 loc) · 3.39 KB
/
ci.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: Docker Image CI
on:
push:
branches:
- master
schedule:
- cron: 0 2 * * *
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
major: [ 7.4, 8.2, 8.3 ]
os: [ debian ]
variant: [ fpm, cli ]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set variables
id: vars
working-directory: ${{ matrix.major }}/${{ matrix.os }}/${{ matrix.variant }}
run: |
echo "repository=${GITHUB_ACTOR}/$(basename ${GITHUB_REPOSITORY})" >> $GITHUB_OUTPUT
echo "version=$(grep -oE 'PHP_VERSION [0-9].[0-9]+.[0-9]+' Dockerfile | grep -oE '[0-9].[0-9]+.[0-9]+')" >> $GITHUB_OUTPUT
echo "workdir=${{ matrix.major }}/${{ matrix.os }}/${{ matrix.variant }}" >> $GITHUB_OUTPUT
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Copy files
run: |
cp -f files/docker-php-ext-* ${{ steps.vars.outputs.workdir }}
cp -f files/docker-php-source ${{ steps.vars.outputs.workdir }}
cp -f files/docker-php-entrypoint-${{ matrix.variant }} ${{ steps.vars.outputs.workdir }}/docker-php-entrypoint
tree ${{ steps.vars.outputs.workdir }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: ${{ steps.vars.outputs.workdir }}
pull: true
push: true
platforms: linux/amd64,linux/arm64
tags: |
${{ steps.vars.outputs.repository }}:${{ matrix.major }}-${{ matrix.variant }}
${{ steps.vars.outputs.repository }}:${{ steps.vars.outputs.version }}-${{ matrix.variant }}
build-slim:
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
major: [ 7.4, 8.2, 8.3 ]
os: [ slim ]
variant: [ fpm, cli ]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set variables
id: vars
working-directory: ${{ matrix.major }}/${{ matrix.os }}/${{ matrix.variant }}
run: |
echo "repository=${GITHUB_ACTOR}/$(basename ${GITHUB_REPOSITORY})" >> $GITHUB_OUTPUT
echo "version=$(grep -oE 'PHP_VERSION [0-9].[0-9]+.[0-9]+' Dockerfile | grep -oE '[0-9].[0-9]+.[0-9]+')" >> $GITHUB_OUTPUT
echo "workdir=${{ matrix.major }}/${{ matrix.os }}/${{ matrix.variant }}" >> $GITHUB_OUTPUT
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: ${{ steps.vars.outputs.workdir }}
pull: true
push: true
platforms: linux/amd64,linux/arm64
tags: |
${{ steps.vars.outputs.repository }}:${{ matrix.major }}-${{ matrix.variant }}-${{ matrix.os }}
${{ steps.vars.outputs.repository }}:${{ steps.vars.outputs.version }}-${{ matrix.variant }}-${{ matrix.os }}