-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile-newrelic
32 lines (24 loc) · 1.41 KB
/
Dockerfile-newrelic
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
ARG PHP_VERSION=8.1
FROM php:${PHP_VERSION} as builder
ARG NEWRELIC_VERS=v10.0.0.312
LABEL maintainer="[email protected]"
LABEL container="PHP newrelic apm image container"
ENV DEBIAN_FRONTEND=noninteractive
ENV TERM=xterm-color
ENV SHELL=/bin/bash
ENV MAKEFLAGS="-j 10 --load-average=10"
RUN apt-get update && apt-get install -y git build-essential libtool-bin libpcre3-dev
RUN curl -LSs https://go.dev/dl/go1.18.3.linux-$(dpkg-architecture --query DEB_BUILD_ARCH).tar.gz -o /tmp/go.tar.gz && \
tar -xzf /tmp/go.tar.gz -C /usr/local
ENV PATH=${PATH}:/usr/local/go/bin
RUN git clone -b ${NEWRELIC_VERS} https://github.com/newrelic/newrelic-php-agent.git /tmp/newrelic-php-agent && cd /tmp/newrelic-php-agent && \
make all && make agent && make agent-install && docker-php-ext-enable newrelic
RUN mkdir /var/log/newrelic && chown 33:33 /var/log/newrelic
FROM php:${PHP_VERSION}
COPY --from=builder /usr/local/lib/php/extensions/*/newrelic.so /tmp/newrelic.so
COPY --from=builder /usr/local/etc/php/conf.d/docker-php-ext-newrelic.ini /usr/local/etc/php/conf.d/docker-php-ext-newrelic.ini
COPY --from=builder /tmp/newrelic-php-agent/bin/client /usr/local/bin/newrelic-client
COPY --from=builder /tmp/newrelic-php-agent/bin/daemon /usr/local/bin/newrelic-daemon
RUN mkdir -p $(php-config --extension-dir) && mkdir -p /src/ \
&& cp /tmp/newrelic.so $(php-config --extension-dir)/ \
&& mv /tmp/newrelic.so /src/