Skip to content

Commit

Permalink
Merge pull request #13 from aspirepress/dev-experience
Browse files Browse the repository at this point in the history
Improving developer experience
  • Loading branch information
sarah-savage authored Oct 13, 2024
2 parents 0c9ccf0 + 8928a0e commit 2754020
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run-checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
- uses: actions/checkout@v4

- name: Build container
run: docker build -t aspirepress/aspirecloud-php -f ./docker/webapp/Dockerfile .
run: docker build --target devphp -t aspirepress/aspirecloud-php -f ./docker/webapp/Dockerfile .

- name: Install Composer dependencies
run: docker run --rm -v $(pwd):/var/www/html aspirepress/aspirecloud-php sh -c "composer install"
Expand Down
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,6 @@ _empty-testing-database: # internal target to empty database

reset-database: _empty-database migrate seed ## Clean database, run migrations and seeds



reset-testing-database: _empty-testing-database migrate-testing seed-testing

run-pgsql: ## Runs Postgres on the command line using the .env file variables
Expand All @@ -123,4 +121,7 @@ network: ## Create application docker network
@bin/create-external-network.sh

rm-network: ## Remove application docker network
@bin/remove-external-network.sh
@bin/remove-external-network.sh

build-prod:
docker build --target prodphp -t aspirepress/aspirecloud-php -f ./docker/webapp/Dockerfile .
5 changes: 3 additions & 2 deletions docker-compose.override.yml.dist
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
services:
webapp:
environment:
- XDEBUG_CONFIG=idekey=PHPSTORM start_with_request=true var_display_max_depth=-1 max_nesting_level=3000 client_host=docker.for.mac.localhost
- XDEBUG_MODE=develop,debug,coverage
- XDEBUG_CONFIG=idekey=PHPSTORM start_with_request=true var_display_max_depth=-1 max_nesting_level=3000 client_host=172.17.0.1
- PHP_IDE_CONFIG=serverName=application.local
- XDEBUG_MODEl=develop,debug,coverage
5 changes: 1 addition & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ services:
build:
context: .
dockerfile: docker/webapp/Dockerfile
environment:
- XDEBUG_CONFIG=idekey=PHPSTORM start_with_request=true var_display_max_depth=-1 max_nesting_level=3000 client_host=docker.for.mac.localhost
- PHP_IDE_CONFIG=serverName=application.local
- XDEBUG_MODEl=develop,debug,coverage
target: devphp
volumes:
- .:/var/www/html
env_file:
Expand Down
44 changes: 26 additions & 18 deletions docker/webapp/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,30 +1,38 @@
FROM php:8.3-fpm-alpine
FROM php:8.3-fpm-alpine AS basephp

MAINTAINER Sarah Savage


RUN export DEBIAN_FRONTEND=noninteractive \
&& apk update \
&& apk add \
bash \
linux-headers \
libpq-dev \
git \
zip \
libzip-dev \
icu-dev \
postgresql-client \
$PHPIZE_DEPS
RUN apk add \
bash \
linux-headers \
libpq-dev \
git \
zip \
libzip-dev \
icu-dev \
postgresql-client \
$PHPIZE_DEPS


RUN docker-php-ext-install pdo \
&& docker-php-ext-install pdo_pgsql \
&& docker-php-ext-install zip \
&& docker-php-ext-install intl \
&& pecl install xdebug-3.3.0 \
&& docker-php-ext-enable xdebug \
&& docker-php-ext-enable pdo_pgsql \
&& pecl install redis \
&& docker-php-ext-enable redis

COPY --from=composer:latest /usr/bin/composer /usr/bin/composer

FROM basephp AS devphp

RUN pecl install xdebug-3.3.0 \
&& docker-php-ext-enable xdebug

COPY ./docker/webapp/php.ini /usr/local/etc/php/php.ini

FROM basephp AS prodphp

COPY . /var/www/html

RUN composer install -n --no-dev -q


2 changes: 1 addition & 1 deletion docker/webapp/php.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ error_reporting=E_ALL & ~E_DEPRECATED

[xdebug]
xdebug.client_host=host.docker.internal
xdebug.mode=debug
xdebug.mode=develop

0 comments on commit 2754020

Please sign in to comment.