|
| 1 | +FROM openresty/openresty:jammy |
| 2 | + |
| 3 | +# {{ x-release-please-start-version }} |
| 4 | +ARG VERSION=2.0.6 |
| 5 | +# {{ x-release-please-end }} |
| 6 | + |
| 7 | +RUN apt-get update && apt-get install -y \ |
| 8 | + curl apt-transport-https ca-certificates \ |
| 9 | + software-properties-common |
| 10 | + |
| 11 | +RUN add-apt-repository ppa:mhier/libboost-latest && \ |
| 12 | + apt-get update && \ |
| 13 | + apt-get install -y boost1.81 |
| 14 | + |
| 15 | +RUN curl https://github.com/launchdarkly/cpp-sdks/releases/download/launchdarkly-cpp-server-v3.3.1/linux-gcc-x64-dynamic.zip -L -o /tmp/sdk.zip && \ |
| 16 | + mkdir ./cpp-sdk && \ |
| 17 | + unzip /tmp/sdk.zip -d ./cpp-sdk && \ |
| 18 | + rm /tmp/sdk.zip |
| 19 | + |
| 20 | +RUN mkdir -p /usr/local/openresty/nginx/scripts |
| 21 | + |
| 22 | +COPY . . |
| 23 | +COPY ./examples/hello-nginx/nginx.conf /usr/local/openresty/nginx/conf/nginx.conf |
| 24 | +COPY ./examples/hello-nginx/shared.lua /usr/local/openresty/nginx/scripts/ |
| 25 | + |
| 26 | +RUN luarocks make launchdarkly-server-sdk-"${VERSION}"-0.rockspec LD_DIR=./cpp-sdk/build-dynamic/release && \ |
| 27 | + cp launchdarkly_server_sdk.so /usr/local/openresty/lualib/ |
| 28 | + |
| 29 | +# The strategy for this Docker example is to download the C++ SDK release artifacts and use those instead of compiling |
| 30 | +# from source. This is for example/CI purposes only; generally it's better to build from source to ensure all libraries |
| 31 | +# are compatible. |
| 32 | +# |
| 33 | +# Since we require a newer version of boost than is available in Ubuntu 22.04, we grab it from a PPA (mhier/libboost-latest). |
| 34 | +# |
| 35 | +# The SDK dynamic libs expect the boost libs to follow a specific naming convention, which isn't what |
| 36 | +# the libraries from the PPA follow ('-mt' suffix is added to indicate the libraries are built with multithreading support enabled.) |
| 37 | +# |
| 38 | +# It's not 100% clear if these libraries are multithread enabled (build logs in the PPA seem to indicate it), |
| 39 | +# but even so, the C++ SDK is single-threaded. |
| 40 | +# |
| 41 | +# To workaround, add symlinks with the expected names. |
| 42 | +RUN cd /usr/lib/x86_64-linux-gnu && \ |
| 43 | + ln -s libboost_json.so.1.81.0 libboost_json-mt-x64.so.1.81.0 && \ |
| 44 | + ln -s libboost_url.so.1.81.0 libboost_url-mt-x64.so.1.81.0 |
0 commit comments