-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add docker compose for development (#33)
* add docker compose for different php versions
- Loading branch information
Showing
4 changed files
with
72 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
ARG PHP_VERSION | ||
ARG ALPINE_VERSION=3.18 | ||
|
||
FROM php:${PHP_VERSION}-cli-alpine${ALPINE_VERSION} | ||
|
||
ARG DOCKER_USER_ID=1001 | ||
ARG DOCKER_GROUP_ID=1001 | ||
ARG PHP_XDEBUG_VERSION | ||
|
||
# https://blog.codito.dev/2022/11/composer-binary-only-docker-images/ | ||
COPY --from=composer/composer:2-bin /composer /usr/local/bin/composer | ||
|
||
RUN if ! getent group "${DOCKER_GROUP_ID}" > /dev/null; \ | ||
then addgroup -S -g "${DOCKER_GROUP_ID}" devs; \ | ||
fi \ | ||
&& if ! getent passwd "${DOCKER_USER_ID}" > /dev/null; \ | ||
then adduser -S -u "${DOCKER_USER_ID}" -G "$(getent group "${DOCKER_GROUP_ID}" | awk -F: '{printf $1}')" dev; \ | ||
fi \ | ||
# php extensions | ||
&& curl --location --output /usr/local/bin/install-php-extensions https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions \ | ||
&& chmod +x /usr/local/bin/install-php-extensions \ | ||
&& sync \ | ||
&& install-php-extensions \ | ||
pcntl \ | ||
xdebug-${PHP_XDEBUG_VERSION} \ | ||
# xdebug command | ||
&& curl --location --output /usr/local/bin/xdebug https://github.com/julienfalque/xdebug/releases/download/v2.0.0/xdebug \ | ||
&& chmod +x /usr/local/bin/xdebug | ||
|
||
COPY docker/xdebug.ini /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
version: '3.8' | ||
|
||
services: | ||
php-7.4: &php | ||
build: | ||
args: | ||
ALPINE_VERSION: "3.16" | ||
PHP_VERSION: "7.4" | ||
PHP_XDEBUG_VERSION: "3.1.2" | ||
working_dir: /app | ||
volumes: | ||
- .:/app | ||
environment: | ||
PHP_IDE_CONFIG: serverName=php-text-parser | ||
php-8.0: | ||
<<: *php | ||
build: | ||
args: | ||
PHP_VERSION: "8.0" | ||
php-8.1: | ||
<<: *php | ||
build: | ||
args: | ||
PHP_VERSION: "8.1" | ||
php-8.2: | ||
<<: *php | ||
build: | ||
args: | ||
PHP_VERSION: "8.2" | ||
PHP_XDEBUG_VERSION: "3.2.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
; XDebug 3 → https://xdebug.org/docs/upgrade_guide | ||
; You can dynamically enable XDebug by setting XDEBUG_MODE env variable. | ||
; Some options can be dynamically overridden with XDEBUG_CONFIG env variable. | ||
xdebug.mode = off | ||
xdebug.start_with_request = yes | ||
xdebug.discover_client_host = true | ||
xdebug.client_host = host.docker.internal | ||
|
||
; Required so XDebug DOES NOT print warning "Could not connect to debugging client" | ||
xdebug.log = /app/docker/php/xdebug.log | ||
xdebug.log_level = 1 |