Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(docker): add xdebug support #81

Merged
merged 25 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
19d86bd
chore(docker): add xdebug support
jokesterfr Feb 28, 2024
5d94b14
Add xdebug install
jokesterfr Feb 28, 2024
981ee68
May fix the build
jokesterfr Feb 28, 2024
73b6999
A bit further
jokesterfr Feb 28, 2024
364022a
Add linux headers
jokesterfr Feb 28, 2024
4f336a7
Merge branch 'main' into fea/add-xdebug-support
jokesterfr Mar 11, 2024
2f1215f
Update examples/xdebug-prestashop/docker-compose.yml
jokesterfr Mar 12, 2024
c882b41
do not wait indefinitely
jokesterfr Mar 12, 2024
03314bf
Merge remote-tracking branch 'refs/remotes/origin/fea/add-xdebug-supp…
jokesterfr Mar 12, 2024
a168bcc
More time is required
jokesterfr Mar 13, 2024
3148947
Merge branch 'main' into fea/add-xdebug-support
jokesterfr Mar 13, 2024
bb2bee5
Important rework of the code structure to lower the images footprint
jokesterfr Mar 14, 2024
c6fae65
Fix autoconf
jokesterfr Mar 14, 2024
215c098
Fix debian build
jokesterfr Mar 14, 2024
a0f22b5
Fix libfreetype-dev dep
jokesterfr Mar 18, 2024
d456019
Extend CI checks (longer but safer)
jokesterfr Mar 18, 2024
ebb510a
Enhance PR CI workflow
jokesterfr Mar 18, 2024
71e63fc
Dynamic dependency version install
jokesterfr Mar 20, 2024
535a21c
haut les coeurs
jokesterfr Mar 20, 2024
8df9057
bibimbap
jokesterfr Mar 20, 2024
cf194ac
Better in another file
jokesterfr Mar 21, 2024
ae1bc7f
Better like so
jokesterfr Mar 21, 2024
410311f
Enable Xdebug only when the flag is set
jokesterfr Mar 26, 2024
ab04819
Many issues were left
jokesterfr Mar 26, 2024
08991aa
Clean doc
jokesterfr Mar 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
sonar-project.properties

PrestaShop/
prestashop/
vendor/
.prestashop-tags
.prestashop-minor-tags
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ PrestaShop Flashlight can be used as a **development environment**, a **CI/CD as
- [Custom post-scripts](./examples/with-post-scripts/)
- [Ngrok tunneling](./examples/ngrok-tunnel)
- [Auto installation of modules](./examples/auto-install-modules/)
- [XDEBUG PrestaShop](./examples/xdebug-prestashop/)
- Develop a PrestaShop Theme (coming soon)
- Use in GitHub Action (coming soon)

Expand Down
9 changes: 7 additions & 2 deletions docker/alpine.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ ENV COMPOSER_HOME=/var/composer
ENV PHP_ENV=development
COPY ./assets/php-configuration.sh /tmp/
RUN apk --no-cache add -U \
bash less vim geoip git tzdata zip curl jq make \
nginx nginx-mod-http-headers-more nginx-mod-http-geoip \
bash less vim geoip git tzdata zip curl jq make autoconf g++ \
linux-headers nginx nginx-mod-http-headers-more nginx-mod-http-geoip\
nginx-mod-stream nginx-mod-stream-geoip ca-certificates \
gnu-libiconv php-common mariadb-client sudo freetype-dev \
zlib-dev libjpeg-turbo-dev libpng-dev oniguruma-dev \
Expand Down Expand Up @@ -56,6 +56,11 @@ RUN PHP_CS_FIXER=$(jq -r '."'"${PHP_VERSION}"'".php_cs_fixer' < /tmp/php-flavour
&& wget -q -O /usr/bin/php-cs-fixer "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/releases/download/${PHP_CS_FIXER}/php-cs-fixer.phar" \
&& chmod a+x /usr/bin/php-cs-fixer

# Install xdebug
RUN PHP_XDEBUG=$(jq -r '."'"${PHP_VERSION}"'".xdebug' < /tmp/php-flavours.json) \
&& pecl install xdebug-${PHP_XDEBUG} \
&& docker-php-ext-enable xdebug

# Install Node.js and pnpm (yarn and npm are included)
RUN if [ "0.0.0" = "$NODE_VERSION" ]; then exit 0; fi \
&& apk --no-cache add -U python3 nodejs npm yarn \
Expand Down
9 changes: 7 additions & 2 deletions docker/debian.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ RUN export DEBIAN_FRONTEND=noninteractive \
&& apt-get update \
&& apt-get install --no-install-recommends -qqy ca-certificates \
&& apt-get install --no-install-recommends -qqy bash less vim git \
tzdata zip unzip curl wget make jq netcat-traditional \
lsb-release libgnutls30 gnupg libiconv-hook1 libonig-dev \
tzdata zip unzip curl wget make jq netcat-traditional build-essential \
lsb-release libgnutls30 gnupg libiconv-hook1 libonig-dev autoconf \
nginx libnginx-mod-http-headers-more-filter libnginx-mod-http-geoip \
libnginx-mod-http-geoip libnginx-mod-stream mariadb-client sudo \
&& apt-get clean \
Expand Down Expand Up @@ -82,6 +82,11 @@ RUN PHP_CS_FIXER=$(jq -r '."'"${PHP_VERSION}"'".php_cs_fixer' < /tmp/php-flavour
&& wget -q -O /usr/bin/php-cs-fixer "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/releases/download/${PHP_CS_FIXER}/php-cs-fixer.phar" \
&& chmod a+x /usr/bin/php-cs-fixer

# Install xdebug
RUN PHP_XDEBUG=$(jq -r '."'"${PHP_VERSION}"'".xdebug' < /tmp/php-flavours.json) \
&& pecl install xdebug-${PHP_XDEBUG} \
&& docker-php-ext-enable xdebug

# Install Node.js and pnpm (yarn and npm are included)
RUN if [ "0.0.0" = "$NODE_VERSION" ]; then exit 0; fi \
&& export DEBIAN_FRONTEND=noninteractive \
Expand Down
31 changes: 31 additions & 0 deletions examples/xdebug-prestashop/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# XDEBUG PrestaShop

You found a bug in PrestaShop? Want to track down a weird behavior? XDEBUG can help you, even within a docker environment. Here is an example to showcase the integration of this tool with PrestaShop Flashlight.

# Requirements

To enable XDEBUG capabilities within your favorite IDE, you have to mount the PrestaShop sources from your local host to the target PrestaShop Flashlight docker container.

```sh
CONTAINER_NAME=flashlight-nightly
PS_FLASHLIGHT_TAG=nightly
docker create --name "$CONTAINER_NAME" "prestashop/prestashop-flashlight:$PS_FLASHLIGHT_TAG"
docker cp "$CONTAINER_NAME:/var/www/html" ./PrestaShop
docker rm "$CONTAINER_NAME"
```

Now you will have the exact copy of the `PS_FLASHLIGHT_TAG` prestashop source code copied locally.
You are now all set to start PrestaShop Flashlight with your local source binding:

```
docker compose up prestashop
```

# Usage

@TODO: describe here some IDE configurations

# External ressources

- xdebug with VSCode: https://marketplace.visualstudio.com/items?itemName=xdebug.php-debug
- xdebug with PHPStorm: https://www.jetbrains.com/help/phpstorm/configuring-xdebug.html
38 changes: 38 additions & 0 deletions examples/xdebug-prestashop/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: flashlight-develop-prestashop
jokesterfr marked this conversation as resolved.
Show resolved Hide resolved
services:
prestashop:
image: prestashop/prestashop-flashlight:latest
depends_on:
mysql:
condition: service_healthy
environment:
- PS_DOMAIN=localhost:8000
- INIT_SCRIPTS_DIR=/tmp/init-scripts
- INIT_SCRIPTS_USER=root
volumes:
- ./PrestaShop:/var/www/html:rw
ports:
- 8000:80

mysql:
image: mariadb:lts
healthcheck:
test:
[
"CMD",
"mysqladmin",
"ping",
"--host=localhost",
"--user=root",
"--password=prestashop",
]
interval: 10s
timeout: 10s
retries: 5
environment:
- MYSQL_HOST=mysql
- MYSQL_USER=prestashop
- MYSQL_PASSWORD=prestashop
- MYSQL_ROOT_PASSWORD=prestashop
- MYSQL_PORT=3306
- MYSQL_DATABASE=prestashop
24 changes: 16 additions & 8 deletions php-flavours.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,55 +4,63 @@
"debian": "7.1-fpm-buster",
"php_cs_fixer": "v3.3.0",
"phpstan": "1.4.10",
"phpunit": "7.5.20"
"phpunit": "7.5.20",
"xdebug": "2.9.8"
},
"7.2": {
"alpine": "7.2-fpm-alpine",
"debian": "7.2-fpm-buster",
"php_cs_fixer": "v3.4.0",
"phpstan": "HEAD",
"phpunit": "8.5.34"
"phpunit": "8.5.34",
"xdebug": "3.1.6"
},
"7.3": {
"alpine": "7.3-fpm-alpine",
"debian": "7.3-fpm-buster",
"php_cs_fixer": "v3.4.0",
"phpstan": "HEAD",
"phpunit": "9.6.13"
"phpunit": "9.6.13",
"xdebug": "3.1.6"
},
"7.4": {
"alpine": "7.4-fpm-alpine",
"debian": "7.4-fpm-buster",
"php_cs_fixer": "v3.40.0",
"phpstan": "HEAD",
"phpunit": "9.6.13"
"phpunit": "9.6.13",
"xdebug": "3.1.6"
},
"8.0": {
"alpine": "8.0-fpm-alpine",
"debian": "8.0-fpm-bullseye",
"php_cs_fixer": "v3.40.0",
"phpstan": "HEAD",
"phpunit": "9.6.13"
"phpunit": "9.6.13",
"xdebug": "3.3.1"
},
"8.1": {
"alpine": "8.1-fpm-alpine",
"debian": "8.1-fpm-bookworm",
"php_cs_fixer": "v3.40.0",
"phpstan": "HEAD",
"phpunit": "10.4.2"
"phpunit": "10.4.2",
"xdebug": "3.3.1"
},
"8.2": {
"alpine": "8.2-fpm-alpine",
"debian": "8.2-fpm-bookworm",
"php_cs_fixer": "v3.40.0",
"phpstan": "HEAD",
"phpunit": "10.4.2"
"phpunit": "10.4.2",
"xdebug": "3.3.1"
},
"8.3": {
"alpine": "8.3-fpm-alpine",
"debian": "8.3-fpm-bookworm",
"php_cs_fixer": "v3.40.0",
"phpstan": "HEAD",
"phpunit": "10.4.2"
"phpunit": "10.4.2",
"xdebug": "3.3.1"
}
}
Loading