Skip to content
Open
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
3 changes: 3 additions & 0 deletions layers/datadog/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ RUN php datadog-setup.php --php-bin=all --enable-profiling

RUN cp "$(php-config --extension-dir)/ddtrace.so" /tmp/ddtrace.so && \
cp "$(php-config --extension-dir)/datadog-profiling.so" /tmp/datadog-profiling.so && \
cp "$(php-config --extension-dir)/ddappsec.so" /tmp/ddappsec.so && \
cp "$(php-config --ini-dir)/98-ddtrace.ini" /tmp/ext.ini

RUN sed -i 's/extension = ddtrace\.so/extension = \/opt\/bref-extra\/ddtrace.so/' /tmp/ext.ini && \
sed -i 's/extension = datadog-profiling\.so/extension = \/opt\/bref-extra\/datadog-profiling.so/' /tmp/ext.ini && \
sed -i 's/extension = ddappsec\.so/\/opt\/bref-extra\/ddappsec.so/' /tmp/ext.ini && \
Copy link
Contributor Author

@annuh annuh May 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another solution could be to simply disable loading the extension, but it looks the datadog-setup script assumes this extension is always there: https://github.com/DataDog/dd-trace-php/blob/master/datadog-setup.php#L577-L580
Possible related: DataDog/dd-trace-php#2014

Suggested change
sed -i 's/extension = ddappsec\.so/\/opt\/bref-extra\/ddappsec.so/' /tmp/ext.ini && \
sed -i 's/extension = ddappsec\.so/;extension = ddappsec\.so/' /tmp/ext.ini && \

sed -i 's/;datadog\.agent_host.*$/datadog\.agent_host = 127.0.0.1/' /tmp/ext.ini && \
sed -i 's/^.*datadog\.appsec\.enabled.*$/datadog.appsec.enabled = Off/' /tmp/ext.ini && \
sed -i 's/datadog\.profiling\.enabled = On/datadog.profiling.enabled = 1/' /tmp/ext.ini
Expand All @@ -29,5 +31,6 @@ FROM scratch
# Copy things we installed to the final image
COPY --from=ext /tmp/ddtrace.so /opt/bref-extra/ddtrace.so
COPY --from=ext /tmp/datadog-profiling.so /opt/bref-extra/datadog-profiling.so
COPY --from=ext /tmp/ddappsec.so /opt/bref-extra/ddappsec.so
COPY --from=ext /tmp/ext.ini /opt/bref/etc/php/conf.d/98-ddtrace.ini
COPY --from=ext /opt/datadog/ /opt/datadog