Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a layer for the opentelemetry php extension #501

Merged
merged 7 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from 4 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
15 changes: 15 additions & 0 deletions layers/opentelemetry/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
ARG PHP_VERSION
ARG BREF_VERSION
FROM bref/build-php-$PHP_VERSION:$BREF_VERSION AS ext

RUN pecl install opentelemetry-1.0.0 > /dev/null
RUN cp `php-config --extension-dir`/opentelemetry.so /tmp/opentelemetry.so
RUN strip --strip-debug /tmp/opentelemetry.so
RUN echo 'extension=opentelemetry.so' > /tmp/ext.ini

# Build the final image with just the files we need
FROM scratch

# Copy things we installed to the final image
COPY --from=ext /tmp/opentelemetry.so /opt/bref/extensions/opentelemetry.so
COPY --from=ext /tmp/ext.ini /opt/bref/etc/php/conf.d/ext-opentelemetry.ini
7 changes: 7 additions & 0 deletions layers/opentelemetry/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"php": [
"80",
"81",
"82"
]
}
8 changes: 8 additions & 0 deletions layers/opentelemetry/test.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

if (!function_exists($function = "OpenTelemetry\Instrumentation\hook")) {
echo sprintf('FAIL: Function "%s" does not exist.', $function) . PHP_EOL;
exit(1);
}

exit(0);
Loading