-
Notifications
You must be signed in to change notification settings - Fork 1
86 lines (72 loc) · 2.59 KB
/
docker.yml
File metadata and controls
86 lines (72 loc) · 2.59 KB
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
---
name: Docker Build
on:
push:
branches:
- main
tags:
- 'v*'
env:
REGISTRY: docker.io
IMAGE_NAME: mohelmrabet/magento-frankenphp
FRANKENPHP_VERSION: '1.10.1'
permissions:
contents: read
jobs:
build-and-push:
name: Build and Push
runs-on: ubuntu-latest
strategy:
matrix:
php_version: ['8.2', '8.3', '8.4']
target: ['base', 'dev']
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE_NAME }}
tags: |
type=raw,value=php${{ matrix.php_version }}-fp${{ env.FRANKENPHP_VERSION }}-${{ matrix.target }}
type=raw,value=${{ matrix.target }},enable=${{ matrix.php_version == '8.4' }}
type=raw,value=latest,enable=${{ matrix.php_version == '8.4' && matrix.target == 'base' }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
target: ${{ matrix.target }}
build-args: |
PHP_VERSION=${{ matrix.php_version }}
FRANKENPHP_VERSION=${{ env.FRANKENPHP_VERSION }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Test image
run: |
IMAGE_TAG="${{ env.IMAGE_NAME }}:php${{ matrix.php_version }}"
IMAGE_TAG="${IMAGE_TAG}-fp${{ env.FRANKENPHP_VERSION }}-${{ matrix.target }}"
echo "🔍 Testing PHP version..."
docker run --rm ${IMAGE_TAG} php -v | grep -q "PHP ${{ matrix.php_version }}"
echo "🔍 Testing PHP extensions..."
docker run --rm ${IMAGE_TAG} php -m | grep -q "bcmath"
docker run --rm ${IMAGE_TAG} php -m | grep -q "gd"
docker run --rm ${IMAGE_TAG} php -m | grep -q "intl"
docker run --rm ${IMAGE_TAG} php -m | grep -q "pdo_mysql"
docker run --rm ${IMAGE_TAG} php -m | grep -q "redis"
echo "🔍 Testing Composer..."
docker run --rm ${IMAGE_TAG} composer --version
echo "🔍 Testing FrankenPHP..."
docker run --rm ${IMAGE_TAG} frankenphp version
echo "✅ All tests passed!"