Skip to content

Instantly share code, notes, and snippets.

@ssi-anik
Created July 6, 2020 17:32
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ssi-anik/84b45774df9ffadeb5179d41bb0fb699 to your computer and use it in GitHub Desktop.
Save ssi-anik/84b45774df9ffadeb5179d41bb0fb699 to your computer and use it in GitHub Desktop.
Elastic APM agent PHP installation in Docker container
FROM php:7.4-fpm
RUN apt-get update
RUN apt-get install -y libpq-dev libpng-dev curl nano unzip zip git jq supervisor
RUN docker-php-ext-install pdo_pgsql
RUN pecl install -o -f redis
RUN docker-php-ext-enable redis
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN apt-get -y update && apt-get -y install build-essential autoconf libcurl4-openssl-dev --no-install-recommends
RUN mkdir -p /home/apm-agent && \
cd /home/apm-agent && \
git clone https://github.com/elastic/apm-agent-php.git apm && \
cd apm/src/ext && \
/usr/local/bin/phpize && ./configure --enable-elastic_apm && \
make clean && make && make install
COPY ./elastic_apm.ini /usr/local/etc/php/conf.d/elastic_apm.ini
RUN mkdir /app
WORKDIR /app
CMD ["php", "-S", "0.0.0.0:80", "index.php"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment