Created
March 23, 2021 15:52
-
-
Save kimsondrup/74bc586f12a52f0dbd38a500793f92d3 to your computer and use it in GitHub Desktop.
bitnami/nginx:1.19.8 opentracing and jaegertracing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################################# Build image for Opentracing Builder ############################################# | |
ARG NGINX_VERSION=1.19.8 | |
FROM bitnami/nginx:${NGINX_VERSION} as opentracing-builder | |
ARG NGINX_VERSION=1.19.8 | |
ARG NGINX_OPENTRACING=0.14.0 | |
ARG OPENTRACING_VERSION=1.6.0 | |
USER root | |
WORKDIR / | |
# Install required packages and build dependencies | |
RUN install_packages \ | |
autoconf \ | |
automake \ | |
build-essential \ | |
cmake \ | |
dirmngr \ | |
git \ | |
gpg \ | |
gpg-agent \ | |
libcurl4-openssl-dev \ | |
libcurl4-openssl-dev \ | |
libgeoip-dev \ | |
liblmdb-dev \ | |
libpcre3-dev \ | |
libprotobuf-dev \ | |
libssl-dev \ | |
libtool \ | |
libxml2-dev \ | |
libyajl-dev \ | |
pkgconf \ | |
protobuf-compiler \ | |
zlib1g-dev | |
# Add trusted NGINX PGP key for tarball integrity verification | |
RUN gpg --keyserver ha.pool.sks-keyservers.net --recv-key 520A9993A1C052F8 | |
# Download NGINX, verify integrity and extract | |
RUN curl -O http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz && \ | |
curl -O http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz.asc && \ | |
gpg --verify nginx-${NGINX_VERSION}.tar.gz.asc nginx-${NGINX_VERSION}.tar.gz && \ | |
tar zxvf nginx-${NGINX_VERSION}.tar.gz && \ | |
rm -f nginx-${NGINX_VERSION}.tar.gz rm nginx-${NGINX_VERSION}.tar.gz.asc | |
RUN git clone --branch v${NGINX_OPENTRACING} https://github.com/opentracing-contrib/nginx-opentracing.git | |
RUN git clone --branch v${OPENTRACING_VERSION} https://github.com/opentracing/opentracing-cpp.git | |
RUN mkdir -p opentracing-cpp/.build && cd opentracing-cpp/.build && \ | |
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DBUILD_STATIC_LIBS=OFF -DBUILD_MOCKTRACER=OFF -DENABLE_LINTING=OFF .. && \ | |
make && make install | |
RUN cd nginx-${NGINX_VERSION} && \ | |
./configure \ | |
--prefix=/opt/bitnami/nginx \ | |
--with-compat --with-debug \ | |
--add-dynamic-module=/nginx-opentracing/opentracing && \ | |
make modules | |
############################################### Build image for Trace builder ############################################### | |
FROM ubuntu AS tracer-builder | |
ARG JAEGER_CPP_VERSION=v0.7.0 | |
RUN apt-get update | |
RUN apt-get install --yes \ | |
build-essential \ | |
curl \ | |
git | |
RUN git clone --depth 1 -b $JAEGER_CPP_VERSION https://github.com/jaegertracing/cpp-client.git jaeger-cpp-client | |
RUN DEBIAN_FRONTEND="noninteractive" apt-get install --yes cmake | |
RUN cd jaeger-cpp-client \ | |
&& mkdir .build \ | |
&& cd .build \ | |
&& cmake -DCMAKE_BUILD_TYPE=Release \ | |
-DJAEGERTRACING_PLUGIN=ON \ | |
-DBUILD_TESTING=OFF \ | |
-DHUNTER_CONFIGURATION_TYPES=Release \ | |
-DJAEGERTRACING_WITH_YAML_CPP=ON \ | |
.. \ | |
&& make \ | |
&& make install \ | |
&& export HUNTER_INSTALL_DIR=$(cat _3rdParty/Hunter/install-root-dir) \ | |
&& cp $HUNTER_INSTALL_DIR/lib/libyaml-cpp.so /usr/local/lib/ \ | |
&& cp libjaegertracing_plugin.so /usr/local/lib/ | |
############################################# Build image for Opentracing ############################################# | |
ARG NGINX_VERSION=1.19.8 | |
FROM bitnami/nginx:${NGINX_VERSION} as opentracing | |
ARG NGINX_VERSION=1.19.8 | |
ARG OPENTRACING_VERSION=1.6.0 | |
USER root | |
RUN install_packages libyaml-cpp0.6 | |
COPY --from=opentracing-builder /nginx-${NGINX_VERSION}/objs/ngx_http_opentracing_module.so /opt/bitnami/nginx/modules/ngx_http_opentracing_module.so | |
COPY --from=opentracing-builder /usr/local/lib/libopentracing.so.${OPENTRACING_VERSION} /usr/local/lib/libopentracing.so.1 | |
COPY --from=tracer-builder /usr/local/lib/libjaegertracing_plugin.so /usr/local/lib/libjaegertracing_plugin.so | |
RUN ldconfig | |
RUN echo 'load_module modules/ngx_http_opentracing_module.so;' | cat - /opt/bitnami/nginx/conf/nginx.conf > /tmp/nginx.conf && \ | |
cp /tmp/nginx.conf /opt/bitnami/nginx/conf/nginx.conf && rm /tmp/nginx.conf | |
USER 1001 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add OpenTracing to the bitnami/nginx container image.
Inspired by github.com/opentracing-contrib/nginx-opentracing/Dockerfile (this file is also a good place to look for version numbers when upgrading)
Build args:
NGINX_VERSION
,NGINX_OPENTRACING
,OPENTRACING_VERSION
andJAEGER_CPP_VERSION