mirror of
https://github.com/jkaninda/laravel-php-fpm.git
synced 2026-11-13 08:37:15 +00:00
Merge pull request #90 from jkaninda/dev
Upgrade images to PHP 8.5 and fix php-fpm not starting as root
This commit is contained in:
1 parent
033c6b213f
commit
7799d2fbc2
23 files changed
+705
-526
No files matched your search
@@ -0,0 +1,6 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: github-actions
|
||||
directory: /
|
||||
schedule:
|
||||
interval: weekly
|
||||
+70
-90
@@ -3,105 +3,85 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
legacy:
|
||||
description: 'Also build legacy images (7.2, 7.3, 7.4, 8.0)'
|
||||
required: false
|
||||
default: false
|
||||
type: boolean
|
||||
|
||||
env:
|
||||
LATEST_PHP: "8.5"
|
||||
|
||||
jobs:
|
||||
docker:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
php: ["8.1", "8.2", "8.3", "8.4", "8.5"]
|
||||
variant: ["debian", "alpine"]
|
||||
steps:
|
||||
-
|
||||
name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
-
|
||||
name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
-
|
||||
name: Login to DockerHub
|
||||
uses: docker/login-action@v2
|
||||
- uses: actions/checkout@v5
|
||||
- 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.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
-
|
||||
name: Build and push 8.1
|
||||
uses: docker/build-push-action@v3
|
||||
- name: Compute tags
|
||||
id: meta
|
||||
run: |
|
||||
image="${{ vars.BUILDKIT_IMAGE }}"
|
||||
if [ "${{ matrix.variant }}" = "alpine" ]; then
|
||||
file=./src/docker/Dockerfile.alpine
|
||||
tags="${image}:${{ matrix.php }}-alpine"
|
||||
[ "${{ matrix.php }}" = "${LATEST_PHP}" ] && tags="${tags},${image}:alpine"
|
||||
else
|
||||
file=./src/docker/Dockerfile
|
||||
tags="${image}:${{ matrix.php }}"
|
||||
[ "${{ matrix.php }}" = "${LATEST_PHP}" ] && tags="${tags},${image}:latest"
|
||||
fi
|
||||
echo "file=${file}" >> "$GITHUB_OUTPUT"
|
||||
echo "tags=${tags}" >> "$GITHUB_OUTPUT"
|
||||
- name: Build and push ${{ matrix.php }} ${{ matrix.variant }}
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
file: "./src/docker/Dockerfile"
|
||||
context: .
|
||||
file: ${{ steps.meta.outputs.file }}
|
||||
push: true
|
||||
pull: true
|
||||
platforms: linux/amd64,linux/arm64
|
||||
build-args: |
|
||||
phpVersion=8.1
|
||||
tags: "${{ vars.BUILDKIT_IMAGE }}:8.1"
|
||||
-
|
||||
name: Build and push 8.1 alpine
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
file: "./src/docker/Dockerfile.alpine"
|
||||
push: true
|
||||
platforms: linux/amd64,linux/arm64
|
||||
build-args: |
|
||||
phpVersion=8.1
|
||||
tags: "${{ vars.BUILDKIT_IMAGE }}:8.1-alpine"
|
||||
-
|
||||
name: Build and push 8.2
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
file: "./src/docker/Dockerfile"
|
||||
push: true
|
||||
platforms: linux/amd64,linux/arm64
|
||||
build-args: |
|
||||
phpVersion=8.2
|
||||
tags: "${{vars.BUILDKIT_IMAGE}}:8.2"
|
||||
-
|
||||
name: Build and push 8.2 alpine
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
file: "./src/docker/Dockerfile.alpine"
|
||||
push: true
|
||||
platforms: linux/amd64,linux/arm64
|
||||
build-args: |
|
||||
phpVersion=8.2
|
||||
tags: "${{vars.BUILDKIT_IMAGE}}:8.2-alpine"
|
||||
-
|
||||
name: Build and push 8.3
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
file: "./src/docker/Dockerfile"
|
||||
push: true
|
||||
platforms: linux/amd64,linux/arm64
|
||||
build-args: |
|
||||
phpVersion=8.3
|
||||
tags: |
|
||||
"${{vars.BUILDKIT_IMAGE}}:8.3"
|
||||
-
|
||||
name: Build and push 8.3 alpine
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
file: "./src/docker/Dockerfile.alpine"
|
||||
push: true
|
||||
platforms: linux/amd64,linux/arm64
|
||||
build-args: |
|
||||
phpVersion=8.3
|
||||
tags: |
|
||||
"${{vars.BUILDKIT_IMAGE}}:8.3-alpine"
|
||||
-
|
||||
name: Build and push 8.4 alpine
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
file: "./src/docker/Dockerfile.alpine"
|
||||
push: true
|
||||
platforms: linux/amd64,linux/arm64
|
||||
build-args: |
|
||||
phpVersion=8.4
|
||||
tags: |
|
||||
"${{vars.BUILDKIT_IMAGE}}:8.4-alpine"
|
||||
-
|
||||
name: Build and push 8.4
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
file: "./src/docker/Dockerfile"
|
||||
push: true
|
||||
platforms: linux/amd64,linux/arm64
|
||||
build-args: |
|
||||
phpVersion=8.4
|
||||
tags: |
|
||||
"${{vars.BUILDKIT_IMAGE}}:8.4"
|
||||
"${{vars.BUILDKIT_IMAGE}}:latest"
|
||||
phpVersion=${{ matrix.php }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
cache-from: type=gha,scope=${{ matrix.php }}-${{ matrix.variant }}
|
||||
cache-to: type=gha,mode=max,scope=${{ matrix.php }}-${{ matrix.variant }}
|
||||
|
||||
legacy:
|
||||
if: ${{ github.event_name == 'workflow_dispatch' && inputs.legacy }}
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
php: ["7.2", "7.3", "7.4", "8.0"]
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
- name: Build and push ${{ matrix.php }}
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
file: ./src/docker/${{ matrix.php }}/Dockerfile
|
||||
push: true
|
||||
tags: ${{ vars.BUILDKIT_IMAGE }}:${{ matrix.php }}
|
||||
@@ -1,138 +0,0 @@
|
||||
name: Manual-build
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
docker_tag:
|
||||
description: 'Docker tag'
|
||||
required: true
|
||||
default: 'latest'
|
||||
type: string
|
||||
jobs:
|
||||
docker:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
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.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
-
|
||||
name: Build and push 7.2
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
file: "./src/docker/7.2/Dockerfile"
|
||||
push: true
|
||||
tags: "${{vars.BUILDKIT_IMAGE}}:7.2"
|
||||
-
|
||||
name: Build and push 7.3
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
file: "./src/docker/7.3/Dockerfile"
|
||||
push: true
|
||||
tags: "${{vars.BUILDKIT_IMAGE}}:7.3"
|
||||
-
|
||||
name: Build and push 7.4
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
file: "./src/docker/7.4/Dockerfile"
|
||||
push: true
|
||||
tags: "${{vars.BUILDKIT_IMAGE}}:7.4"
|
||||
-
|
||||
name: Build and push 8.0
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
file: "./src/docker/8.0/Dockerfile"
|
||||
push: true
|
||||
tags: "${{vars.BUILDKIT_IMAGE}}:8.0"
|
||||
-
|
||||
name: Build and push 8.1
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
file: "./src/docker/Dockerfile"
|
||||
push: true
|
||||
platforms: linux/amd64,linux/arm64
|
||||
build-args: |
|
||||
phpVersion=8.1
|
||||
tags: "${{ vars.BUILDKIT_IMAGE }}:8.1"
|
||||
-
|
||||
name: Build and push 8.1 alpine
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
file: "./src/docker/Dockerfile.alpine"
|
||||
push: true
|
||||
platforms: linux/amd64,linux/arm64
|
||||
build-args: |
|
||||
phpVersion=8.1
|
||||
tags: "${{ vars.BUILDKIT_IMAGE }}:8.1-alpine"
|
||||
-
|
||||
name: Build and push 8.2
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
file: "./src/docker/Dockerfile"
|
||||
push: true
|
||||
platforms: linux/amd64,linux/arm64
|
||||
build-args: |
|
||||
phpVersion=8.2
|
||||
tags: "${{vars.BUILDKIT_IMAGE}}:8.2"
|
||||
-
|
||||
name: Build and push 8.2 alpine
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
file: "./src/docker/Dockerfile.alpine"
|
||||
push: true
|
||||
platforms: linux/amd64,linux/arm64
|
||||
build-args: |
|
||||
phpVersion=8.2
|
||||
tags: "${{vars.BUILDKIT_IMAGE}}:8.2-alpine"
|
||||
-
|
||||
name: Build and push 8.3
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
file: "./src/docker/Dockerfile"
|
||||
push: true
|
||||
platforms: linux/amd64,linux/arm64
|
||||
build-args: |
|
||||
phpVersion=8.3
|
||||
tags: |
|
||||
"${{vars.BUILDKIT_IMAGE}}:8.3"
|
||||
-
|
||||
name: Build and push 8.3 alpine
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
file: "./src/docker/Dockerfile.alpine"
|
||||
push: true
|
||||
platforms: linux/amd64,linux/arm64
|
||||
build-args: |
|
||||
phpVersion=8.3
|
||||
tags: |
|
||||
"${{vars.BUILDKIT_IMAGE}}:8.3-alpine"
|
||||
-
|
||||
name: Build and push 8.4 alpine
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
file: "./src/docker/Dockerfile.alpine"
|
||||
push: true
|
||||
platforms: linux/amd64,linux/arm64
|
||||
build-args: |
|
||||
phpVersion=8.4
|
||||
tags: |
|
||||
"${{vars.BUILDKIT_IMAGE}}:8.4-alpine"
|
||||
-
|
||||
name: Build and push 8.4
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
file: "./src/docker/Dockerfile"
|
||||
push: true
|
||||
platforms: linux/amd64,linux/arm64
|
||||
build-args: |
|
||||
phpVersion=8.4
|
||||
tags: |
|
||||
"${{vars.BUILDKIT_IMAGE}}:8.4"
|
||||
"${{vars.BUILDKIT_IMAGE}}:latest"
|
||||
+24
-46
@@ -1,53 +1,31 @@
|
||||
name: Tests
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
integration:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
php: ["8.1", "8.2", "8.3", "8.4", "8.5"]
|
||||
variant: ["debian", "alpine"]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Build Docker Image
|
||||
run: |
|
||||
docker buildx build -f src/docker/Dockerfile --build-arg phpVersion=8.4 -t ${{ vars.BUILDKIT_IMAGE }}:latest --load .
|
||||
- name: Verify Docker images
|
||||
run: |
|
||||
docker images
|
||||
- name: Create Laravel project
|
||||
run: |
|
||||
composer create-project laravel/laravel laravel
|
||||
- name: Fix Permission
|
||||
run: chmod -R 777 ./laravel/storage
|
||||
- name: Run docker-compose
|
||||
run:
|
||||
cp ./tests/compose.yaml compose.yaml &&
|
||||
docker compose -f "compose.yaml" up -d
|
||||
- name: Create script.js for K6 test
|
||||
run: |
|
||||
touch script.js && cat > script.js <<EOF
|
||||
import http from 'k6/http';
|
||||
import { sleep } from 'k6';
|
||||
|
||||
export default function () {
|
||||
//Link
|
||||
http.get('http://localhost');
|
||||
}
|
||||
EOF
|
||||
- name: Install k6
|
||||
run: |
|
||||
curl https://github.com/grafana/k6/releases/download/v0.47.0/k6-v0.47.0-linux-amd64.tar.gz -L | tar xvz --strip-components 1
|
||||
- name: Test with K6
|
||||
run: |
|
||||
./k6 run script.js
|
||||
- name: Test with curl
|
||||
run: |
|
||||
curl -i http://localhost
|
||||
- name: Waiting for database connection
|
||||
run: |
|
||||
while ! docker exec mysql mysql --user=root --password=password -e "status" &> /dev/null ; do
|
||||
echo "Waiting for database connection..."
|
||||
sleep 5
|
||||
done
|
||||
- name: Laravel database migration test
|
||||
run: |
|
||||
docker exec php-fpm php artisan migrate
|
||||
|
||||
- uses: actions/checkout@v5
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
- name: Build Docker image
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
file: ${{ matrix.variant == 'alpine' && './src/docker/Dockerfile.alpine' || './src/docker/Dockerfile' }}
|
||||
load: true
|
||||
build-args: |
|
||||
phpVersion=${{ matrix.php }}
|
||||
tags: laravel-php-fpm:test
|
||||
cache-from: type=gha,scope=${{ matrix.php }}-${{ matrix.variant }}
|
||||
- name: Run integration tests
|
||||
env:
|
||||
IMAGE: laravel-php-fpm:test
|
||||
run: ./tests/integration.sh
|
||||
Reference in new issue
Block a user