Skip to content

Instantly share code, notes, and snippets.

@ralphschindler
Created September 8, 2021 13:39
Show Gist options
  • Save ralphschindler/05ef2bcb5aaf640bcb07957fbec20c56 to your computer and use it in GitHub Desktop.
Save ralphschindler/05ef2bcb5aaf640bcb07957fbec20c56 to your computer and use it in GitHub Desktop.
Build php xdebug from scratch in a Docker container, with laravel app
FROM ubuntu:20.10
RUN mkdir /app
WORKDIR /app
RUN apt-get update && DEBIAN_FRONTEND=noninteractive \
apt-get install -qqy --no-install-recommends \
ca-certificates \
valgrind \
gdb \
build-essential \
net-tools \
autoconf \
bison \
re2c \
libxml2-dev \
libcurl4-openssl-dev \
libjpeg-dev \
libpng-dev \
libxpm-dev \
libmysqlclient-dev \
libpq-dev \
libicu-dev \
libfreetype6-dev \
libldap2-dev \
libxslt-dev \
libssl-dev \
libldb-dev \
libsqlite3-dev \
libonig-dev \
nano \
git \
wget \
unzip \
less \
curl \
&& rm -rf /var/lib/apt/lists/*
# I am grabbing a copy of master, not checking it out b/c it is HUGE, and I dont want the image to be that large
RUN wget -q https://github.com/php/php-src/archive/master.zip \
&& unzip master.zip \
&& rm master.zip \
&& cd php-src-master \
&& ./buildconf \
&& ./configure --enable-debug --prefix=/app/php/ --with-openssl --with-zlib --enable-mbstring \
&& make -j4 \
&& make install
RUN git clone https://github.com/xdebug/xdebug.git \
&& cd xdebug \
&& /app/php/bin/phpize \
&& ./configure --with-php-config=/app/php/bin/php-config \
&& make \
&& make install
ENV PATH="$PATH:/app/php/bin"
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/app/php/bin --filename=composer
RUN composer --quiet create-project --no-dev --ignore-platform-reqs laravel/laravel test-laravel-app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment