Skip to content

Commit 11150a0

Browse files
pscheitclaude
andcommitted
add multi-stage Docker build with CI support
- Add dev stage with xdebug for local development - Add ci stage with composer dependencies for GitHub Actions - Update docker-compose to target dev stage - Add GitHub Actions workflow for continuous integration 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent bf990a6 commit 11150a0

3 files changed

Lines changed: 30 additions & 1 deletion

File tree

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Continuous Integration
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Build Docker image
17+
run: docker build -t webforge-utils-ci -f config/docker/php/Dockerfile --target ci .
18+
19+
- name: Run PHPUnit tests
20+
run: docker run --rm webforge-utils-ci ./vendor/bin/phpunit

config/docker/php/Dockerfile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM php:8.4-fpm
1+
FROM php:8.4-fpm AS base
22

33
RUN apt-get update && apt-get install -y git zip unzip
44

@@ -9,3 +9,11 @@ RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" \
99
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
1010

1111
WORKDIR /app
12+
13+
FROM base AS dev
14+
RUN pecl install xdebug && docker-php-ext-enable xdebug
15+
16+
FROM base AS ci
17+
COPY composer.json composer.lock ./
18+
RUN composer install --prefer-dist --no-progress
19+
COPY . .

docker-compose.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ services:
33
build:
44
context: .
55
dockerfile: ./config/docker/php/Dockerfile
6+
target: dev
67
volumes:
78
- .:/app
89
user: "33:33"

0 commit comments

Comments
 (0)