SilentEntity opened a new issue, #530:
URL: https://github.com/apache/apisix-docker/issues/530

   There is a requirement to install brotli in OS for it to work.
   
   For local/master build development, here is an example:
   
   Inside 
[Dockerfile](https://github.com/apache/apisix-docker/blob/master/debian-dev/Dockerfile),
 these are the following things that need to be done.
   - Correct openresty path for apisix installation.
   - Install brotli 
   
   Example for adding path of openresty:
   ```
   FROM api7/apisix-runtime:dev AS build
   
   ARG ENABLE_PROXY=false
   
   ENV DEBIAN_FRONTEND noninteractive
   
   ENV PATH=$PATH:/usr/local/openresty/bin
   ```
   
   Example for installing brotli using script `install-brotli.sh`:
   ```
   
   FROM api7/apisix-runtime:dev AS production-stage
   
   COPY --from=build /usr/local/apisix /usr/local/apisix
   COPY --from=build /usr/bin/apisix /usr/bin/apisix
   
   ENV DEBIAN_FRONTEND noninteractive
   RUN apt-get -y update --fix-missing \
       && apt-get install -y \
           libldap2-dev \
       && apt-get remove --purge --auto-remove -y
   
   COPY install-brotli.sh /install-brotli.sh
   RUN chmod +x /install-brotli.sh \  
       && cd / && ./install-brotli.sh && rm -rf /install-brotli.sh
   
   ```
   
   `install-brotli.sh` script:
   ```
   install_brotli () {
       apt-get install -y sudo cmake wget unzip
       local BORTLI_VERSION="1.1.0"
       wget -q 
https://github.com/google/brotli/archive/refs/tags/v${BORTLI_VERSION}.zip || 
exit -1 
       unzip v${BORTLI_VERSION}.zip && cd ./brotli-${BORTLI_VERSION} && mkdir 
build && cd build || exit -1 
       local CMAKE=$(command -v cmake3 > /dev/null 2>&1 && echo cmake3 || echo 
cmake) || exit -1 
       ${CMAKE} -DCMAKE_BUILD_TYPE=Release 
-DCMAKE_INSTALL_PREFIX=/usr/local/brotli .. || exit -1 
       sudo ${CMAKE} --build . --config Release --target install || exit -1
       if [ -d "/usr/local/brotli/lib64" ]; then
           echo /usr/local/brotli/lib64 | sudo tee /etc/ld.so.conf.d/brotli.conf
       else
           echo /usr/local/brotli/lib | sudo tee /etc/ld.so.conf.d/brotli.conf
       fi
       sudo ldconfig || exit -1
       ln -sf /usr/local/brotli/bin/brotli /usr/bin/brotli
       cd ../..
       rm -rf brotli-${BORTLI_VERSION}
       rm -rf /v${BORTLI_VERSION}.zip
       export SUDO_FORCE_REMOVE=yes
       apt purge -qy cmake sudo wget unzip
       apt-get remove --purge --auto-remove -y
   }
   install_brotli
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to