Skip to content

Commit

Permalink
Merge pull request #73 from Kong/libxslt
Browse files Browse the repository at this point in the history
fix(*): build libxslt as part of base image
  • Loading branch information
Hans Hübner authored Nov 14, 2022
2 parents 694b191 + 7465a35 commit 605000d
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 6 deletions.
6 changes: 4 additions & 2 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ ARG KONG_LIBNETTLE
ARG KONG_LIBJQ
ARG KONG_EXPAT
ARG KONG_LIBXML2
ARG KONG_LIBXSLT
ARG RESTY_LMDB
ARG RESTY_WEBSOCKET
ARG ATC_ROUTER
Expand All @@ -61,6 +62,7 @@ ENV LIBNETTLE_INSTALL=${BUILD_PREFIX}/libnettle
ENV LIBJQ_INSTALL=${BUILD_PREFIX}/libjq
ENV EXPAT_INSTALL=${BUILD_PREFIX}/expat
ENV LIBXML2_INSTALL=${BUILD_PREFIX}/libxml2
ENV LIBXSLT_INSTALL=${BUILD_PREFIX}/libxslt

RUN mkdir -p ${BUILD_PREFIX}
COPY build.sh ${BUILD_PREFIX}
Expand All @@ -72,8 +74,8 @@ ENV OPENSSL_LIBDIR=${OPENSSL_INSTALL}

ENV PATH=$PATH:${OPENRESTY_INSTALL}/nginx/sbin:${OPENRESTY_INSTALL}/bin:${LUAROCKS_INSTALL}/bin
ENV PATH=${OPENSSL_INSTALL}/bin:$PATH
ENV LD_LIBRARY_PATH=${OPENSSL_INSTALL}/lib:${LIBGMP_INSTALL}/lib:${LIBNETTLE_INSTALL}/lib:${LIBJQ_INSTALL}/lib:${EXPAT_INSTALL}/lib:${LIBXML2_INSTALL}/lib:${LD_LIBRARY_PATH}
ENV C_INCLUDE_PATH=${EXPAT_INSTALL}/include:${LIBXML2_INSTALL}/include
ENV LD_LIBRARY_PATH=${OPENSSL_INSTALL}/lib:${LIBGMP_INSTALL}/lib:${LIBNETTLE_INSTALL}/lib:${LIBJQ_INSTALL}/lib:${EXPAT_INSTALL}/lib:${LIBXML2_INSTALL}/lib:${LIBXSLT_INSTALL}/lib:${LD_LIBRARY_PATH}
ENV C_INCLUDE_PATH=${EXPAT_INSTALL}/include:${LIBXML2_INSTALL}/include:${LIBXSLT_INSTALL}/include

# Extra tools
RUN apt-get update --fix-missing && \
Expand Down
27 changes: 23 additions & 4 deletions docker/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ function download_libxml2 {
| tar -C "${LIBXML2_INSTALL}" -xJ --strip-components=1
}

function download_libxslt {
mkdir -p "${LIBXSLT_INSTALL}"
curl -sSL "https://download.gnome.org/sources/libxslt/$(echo ${KONG_LIBXSLT} | sed -e 's/\.[0-9]*$//')/libxslt-${KONG_LIBXSLT}.tar.xz" \
| tar -C "${LIBXSLT_INSTALL}" -xJ --strip-components=1
}

function make_kong_ngx_module {
make -C ${KONG_NGX_MODULE_INSTALL} LUA_LIB_DIR=${OPENRESTY_INSTALL}/lualib install
}
Expand Down Expand Up @@ -121,14 +127,10 @@ function make_libxml2 {
--prefix="${LIBXML2_INSTALL}" \
--without-catalog \
--without-debug \
--without-html \
--without-http \
--without-iconv \
--without-python \
--without-sax1 \
--without-schemas \
--without-schematron \
--without-valid \
--without-xinclude \
--without-xptr \
--without-modules
Expand All @@ -138,6 +140,19 @@ function make_libxml2 {
)
}

function make_libxslt {
(
cd "${LIBXSLT_INSTALL}" || return
PATH=${LIBXML2_INSTALL}/bin:$PATH \
./configure --disable-static \
--without-python \
--prefix="${LIBXSLT_INSTALL}"

make
make install
)
}

function build {
local flags=(
"--prefix ${BUILD_PREFIX}"
Expand Down Expand Up @@ -211,6 +226,10 @@ function build {
download_libxml2
after+=(make_libxml2)
fi
if [[ -n "$KONG_LIBXSLT" ]]; then
download_libxslt
after+=(make_libxslt)
fi

# `rustc` for atc-router
if [[ -n "$ATC_ROUTER" ]]; then
Expand Down
13 changes: 13 additions & 0 deletions gojira.sh
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,7 @@ function image_name {
KONG_LIBJQ=${JQ_VERSION:-$(req_find $req_file KONG_DEP_LIBJQ_VERSION)}
KONG_EXPAT=${EXPAT_VERSION:-$(req_find $req_file KONG_DEP_EXPAT_VERSION)}
KONG_LIBXML2=${LIBXML2_VERSION:-$(req_find $req_file KONG_DEP_LIBXML2_VERSION)}
KONG_LIBXSLT=${LIBXSLT_VERSION:-$(req_find $req_file KONG_DEP_LIBXSLT_VERSION)}
RESTY_LMDB=${RESTY_LMDB:-$(req_find $req_file RESTY_LMDB_VERSION)}
RESTY_WEBSOCKET=${RESTY_WEBSOCKET:-$(req_find $req_file RESTY_WEBSOCKET_VERSION)}
ATC_ROUTER=${ATC_ROUTER:-$(req_find $req_file ATC_ROUTER_VERSION)}
Expand Down Expand Up @@ -632,6 +633,11 @@ function image_name {
"libxml2-$KONG_LIBXML2"
)
fi
if [[ -n "$KONG_LIBXSLT" ]]; then
components+=(
"libxslt-$KONG_LIBXSLT"
)
fi
if [[ -n "$RESTY_LMDB" ]]; then
components+=(
"resty-lmdb-$RESTY_LMDB"
Expand Down Expand Up @@ -758,6 +764,13 @@ function build {
)
>&2 echo " * libxml2: $KONG_LIBXML2"
fi
if [[ -n "$KONG_LIBXSLT" ]]; then
BUILD_ARGS+=(
"--build-arg KONG_LIBXSLT=$KONG_LIBXSLT"
"--label KONG_LIBXSLT=$KONG_LIBXSLT"
)
>&2 echo " * libxslt: $KONG_LIBXSLT"
fi
>&2 echo "=========================="
>&2 echo ""

Expand Down

0 comments on commit 605000d

Please sign in to comment.