Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion php/.env
Original file line number Diff line number Diff line change
@@ -1 +1 @@
DD_TRACE_VERSION=0.30.0
DD_TRACE_VERSION=0.34.0
3 changes: 3 additions & 0 deletions php/Dockerfiles/nginx/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM nginx:1.17.5-alpine

COPY ./default.conf /etc/nginx/conf.d/default.conf
33 changes: 33 additions & 0 deletions php/Dockerfiles/nginx/default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
server {
listen 80;

access_log /dev/stdout;
error_log /dev/stdout;

server_name localhost;

root /var/www/public;
index index.html index.php;

rewrite ^/(73)/(.*\.(gif|jpg|png|ico|css|js))$ /$2 last;

location / {
add_header X-uri $uri always;
add_header X-document_root $document_root always;
add_header X-fastcgi_script_name $fastcgi_script_name always;
add_header X-fastcgi_path_info $fastcgi_path_info always;
add_header X-PHP-VERSION $1 always;
add_header X-PHP-PATH $2 always;

location ~* ^/(73)(.+)$ {
try_files $2 $2/index.php =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php-fpm-73:9000;
fastcgi_index index.php;
include fastcgi_params;
include fastcgi_params_shared;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}
}
3 changes: 3 additions & 0 deletions php/Dockerfiles/nginx/fastcgi_params_shared
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fastcgi_param DD_SHARED_VALUE "Some shared value";
fastcgi_param DD_AGENT_HOST agent;
fastcgi_param DD_TRACE_URL_AS_RESOURCE_NAMES_ENABLED true;
20 changes: 20 additions & 0 deletions php/Dockerfiles/php-fpm/Dockerfile73
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM php:7.3-fpm

RUN apt-get update \
&& apt-get install -y libmcrypt-dev \
&& pecl install mcrypt-1.0.3 \
&& docker-php-ext-enable mcrypt \
&& docker-php-ext-install mysqli \
&& rm -rf /var/lib/apt/lists/*

# Install composer
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
&& php composer-setup.php --install-dir="/usr/bin" --filename=composer \
&& php -r "unlink('composer-setup.php');" \
&& composer self-update

ARG DD_TRACE_VERSION

# Install DDTrace deb
ADD https://github.com/DataDog/dd-trace-php/releases/download/${DD_TRACE_VERSION}/datadog-php-tracer_${DD_TRACE_VERSION}_amd64.deb datadog-php-tracer.deb
RUN dpkg -i datadog-php-tracer.deb
3 changes: 3 additions & 0 deletions php/apps/basic/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php

echo "PHP FPM works! PHP version: " . phpversion() . "\n";
29 changes: 26 additions & 3 deletions php/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
version: "3.4"
version: '3.4'

services:

agent:
image: datadog/agent:latest
volumes:
Expand Down Expand Up @@ -124,7 +123,31 @@ services:
environment:
DD_AGENT_HOST: agent
DD_TRACE_APP_NAME: symfony_php56_apache
DD_TRACE_DEBUG: "true"
DD_TRACE_DEBUG: 'true'

nginx:
build:
context: Dockerfiles/nginx
volumes:
- ./apps:/var/www/public
- ./Dockerfiles/nginx/default.conf:/etc/nginx/conf.d/default.conf
- ./Dockerfiles/nginx/fastcgi_params_shared:/etc/nginx/fastcgi_params_shared
depends_on:
- php-fpm-73
ports:
- '5678:80'

php-fpm-73:
build:
context: Dockerfiles/php-fpm
dockerfile: Dockerfile73
args:
- DD_TRACE_VERSION=${DD_TRACE_VERSION}
depends_on:
- agent
- mysql
volumes:
- ./apps:/var/www/public

volumes:
composer-cache:
Expand Down