Skip to content

Commit

Permalink
[Feature] Integrate xDebug. (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
lazerg authored Jun 20, 2024
1 parent f2c45b2 commit 66925e7
Show file tree
Hide file tree
Showing 5 changed files with 253 additions and 228 deletions.
1 change: 1 addition & 0 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ docker image push lazerg/laravel:latest

- [PHP](https://hub.docker.com/_/php) Official Image
- [lazerg/laravel](https://hub.docker.com/r/lazerg/laravel)
- [xDebug Setup](https://youtu.be/4opFac50Vwo)
120 changes: 63 additions & 57 deletions php80.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,70 +1,76 @@
FROM php:8.0.30-fpm

# Update and install dependencies
RUN apt-get update && apt-get install -y \
libfreetype6-dev \
libjpeg62-turbo-dev \
libmcrypt-dev \
libpng-dev \
zlib1g-dev \
libxml2-dev \
libzip-dev \
libonig-dev \
graphviz \
libicu-dev \
ghostscript \
supervisor \
dos2unix \
mc \
htop \
nano \
wget \
nginx \
git \
# Install dependencies
RUN apt-get update
RUN apt-get install -y libfreetype6-dev
RUN apt-get install -y libjpeg62-turbo-dev
RUN apt-get install -y libmcrypt-dev
RUN apt-get install -y libpng-dev
RUN apt-get install -y zlib1g-dev
RUN apt-get install -y libxml2-dev
RUN apt-get install -y libzip-dev
RUN apt-get install -y libonig-dev
RUN apt-get install -y graphviz
RUN apt-get install -y libicu-dev
RUN apt-get install -y ghostscript
RUN apt-get install -y supervisor
RUN apt-get install -y dos2unix
RUN apt-get install -y mc
RUN apt-get install -y htop
RUN apt-get install -y nano
RUN apt-get install -y wget
RUN apt-get install -y nginx
RUN apt-get install -y git

# Node.js
&& curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
&& apt-get install -y nodejs \
&& npm install -g yarn \
# Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

# GD extension
&& docker-php-ext-configure gd \
--with-freetype=/usr/include/ \
--with-jpeg=/usr/include/ \
&& docker-php-ext-install gd \
# GD extension
RUN docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/
RUN docker-php-ext-install gd

# Swoole extension
&& pecl install swoole \
&& docker-php-ext-enable swoole \
# Swoole extension
RUN pecl install swoole
RUN docker-php-ext-enable swoole

# Redis extension
&& pecl install -o -f redis \
&& rm -rf /tmp/pear \
&& docker-php-ext-enable redis \
# Redis extension
RUN pecl install -o -f redis
RUN rm -rf /tmp/pear
RUN docker-php-ext-enable redis

# Other PHP extensions
&& docker-php-ext-install pdo_mysql \
&& docker-php-ext-install zip \
&& docker-php-ext-install intl \
&& docker-php-ext-install exif \
&& docker-php-ext-install sockets \
&& docker-php-ext-install pcntl \
&& docker-php-source delete \
# xDebug
RUN pecl install xdebug;
RUN docker-php-ext-enable xdebug;

# PostgreSQL
&& apt-get install -y libpq-dev \
&& docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql \
&& docker-php-ext-install pdo pdo_pgsql pgsql \
# xDebug configuration
RUN echo "zend_extension=xdebug.so" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
RUN echo "xdebug.mode=develop,debug" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
RUN echo "xdebug.start_with_request=yes" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
RUN echo "xdebug.discover_client_host=0" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
RUN echo "xdebug.client_host=host.docker.internal" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini

# Composer
&& curl -sS https://getcomposer.org/installer | php -- \
--install-dir=/usr/local/bin --filename=composer \
# Other PHP extensions
RUN docker-php-ext-install pdo_mysql
RUN docker-php-ext-install zip
RUN docker-php-ext-install intl
RUN docker-php-ext-install exif
RUN docker-php-ext-install sockets
RUN docker-php-ext-install pcntl
RUN docker-php-source delete

# Aliases
&& echo "\
alias 'p=php artisan test' \n\
alias 'pf=php artisan test --filter=' \n\
" >> ~/.bashrc
# PostgreSQL
RUN apt-get install -y libpq-dev
RUN docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql
RUN docker-php-ext-install pdo pdo_pgsql pgsql

# Node.js
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
RUN apt-get install -y nodejs
RUN npm install -g yarn

# Aliases
RUN echo "alias 'p=php artisan test'" >> ~/.bashrc
RUN echo "alias 'pf=php artisan test --filter='" >> ~/.bashrc

WORKDIR /var/www/app/

Expand Down
120 changes: 63 additions & 57 deletions php81.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,70 +1,76 @@
FROM php:8.1.29-fpm

# Update and install dependencies
RUN apt-get update && apt-get install -y \
libfreetype6-dev \
libjpeg62-turbo-dev \
libmcrypt-dev \
libpng-dev \
zlib1g-dev \
libxml2-dev \
libzip-dev \
libonig-dev \
graphviz \
libicu-dev \
ghostscript \
supervisor \
dos2unix \
mc \
htop \
nano \
wget \
nginx \
git \
# Install dependencies
RUN apt-get update
RUN apt-get install -y libfreetype6-dev
RUN apt-get install -y libjpeg62-turbo-dev
RUN apt-get install -y libmcrypt-dev
RUN apt-get install -y libpng-dev
RUN apt-get install -y zlib1g-dev
RUN apt-get install -y libxml2-dev
RUN apt-get install -y libzip-dev
RUN apt-get install -y libonig-dev
RUN apt-get install -y graphviz
RUN apt-get install -y libicu-dev
RUN apt-get install -y ghostscript
RUN apt-get install -y supervisor
RUN apt-get install -y dos2unix
RUN apt-get install -y mc
RUN apt-get install -y htop
RUN apt-get install -y nano
RUN apt-get install -y wget
RUN apt-get install -y nginx
RUN apt-get install -y git

# Node.js
&& curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
&& apt-get install -y nodejs \
&& npm install -g yarn \
# Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

# GD extension
&& docker-php-ext-configure gd \
--with-freetype=/usr/include/ \
--with-jpeg=/usr/include/ \
&& docker-php-ext-install gd \
# GD extension
RUN docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/
RUN docker-php-ext-install gd

# Swoole extension
&& pecl install swoole \
&& docker-php-ext-enable swoole \
# Swoole extension
RUN pecl install swoole
RUN docker-php-ext-enable swoole

# Redis extension
&& pecl install -o -f redis \
&& rm -rf /tmp/pear \
&& docker-php-ext-enable redis \
# Redis extension
RUN pecl install -o -f redis
RUN rm -rf /tmp/pear
RUN docker-php-ext-enable redis

# Other PHP extensions
&& docker-php-ext-install pdo_mysql \
&& docker-php-ext-install zip \
&& docker-php-ext-install intl \
&& docker-php-ext-install exif \
&& docker-php-ext-install sockets \
&& docker-php-ext-install pcntl \
&& docker-php-source delete \
# xDebug
RUN pecl install xdebug;
RUN docker-php-ext-enable xdebug;

# PostgreSQL
&& apt-get install -y libpq-dev \
&& docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql \
&& docker-php-ext-install pdo pdo_pgsql pgsql \
# xDebug configuration
RUN echo "zend_extension=xdebug.so" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
RUN echo "xdebug.mode=develop,debug" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
RUN echo "xdebug.start_with_request=yes" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
RUN echo "xdebug.discover_client_host=0" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
RUN echo "xdebug.client_host=host.docker.internal" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini

# Composer
&& curl -sS https://getcomposer.org/installer | php -- \
--install-dir=/usr/local/bin --filename=composer \
# Other PHP extensions
RUN docker-php-ext-install pdo_mysql
RUN docker-php-ext-install zip
RUN docker-php-ext-install intl
RUN docker-php-ext-install exif
RUN docker-php-ext-install sockets
RUN docker-php-ext-install pcntl
RUN docker-php-source delete

# Aliases
&& echo "\
alias 'p=php artisan test' \n\
alias 'pf=php artisan test --filter=' \n\
" >> ~/.bashrc
# PostgreSQL
RUN apt-get install -y libpq-dev
RUN docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql
RUN docker-php-ext-install pdo pdo_pgsql pgsql

# Node.js
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
RUN apt-get install -y nodejs
RUN npm install -g yarn

# Aliases
RUN echo "alias 'p=php artisan test'" >> ~/.bashrc
RUN echo "alias 'pf=php artisan test --filter='" >> ~/.bashrc

WORKDIR /var/www/app/

Expand Down
Loading

0 comments on commit 66925e7

Please sign in to comment.