Question about the Docker Build ? Throws and error in some cases.
sscotti opened this issue · 2 comments
I'll have to check the Docker Engine and Docker Compose version, but I tried to build the module on a server using the syntax in your sample Docker file. On on my installation it threw an error regarding "BUILD_FLAGS=''". I changed the syntax of that and it built successfully, but it builds fine with the syntax shown below on other systems. To 'fix' it on that other system I explicitly use v. 1.24.0 and basically get rid of the logic:
RUN ./configure --with-compat --add-dynamic-module=../ngx-http-auth-jwt-module --with-cc-opt=-DNGX_LINKED_LIST_COOKIES=1
and it seems to build and function OK.
I'll have to refactor my Docker File if I want to use the module though because I simply compile it now and then use it for another build of the same version of NGINX.
RUN <<`
BUILD_FLAGS=''
MAJ=$(echo ${NGINX_VERSION} | cut -f1 -d.)
MIN=$(echo ${NGINX_VERSION} | cut -f2 -d.)
REV=$(echo ${NGINX_VERSION} | cut -f3 -d.)
# NGINX 1.23.0+ changes cookies to use a linked list, and renames `cookies` to `cookie`
if [ "${MAJ}" -gt 1 ] || [ "${MAJ}" -eq 1 -a "${MIN}" -ge 23 ]; then
BUILD_FLAGS="${BUILD_FLAGS} --with-cc-opt='-DNGX_LINKED_LIST_COOKIES=1'"
fi
./configure --with-compat --add-dynamic-module=../ngx-http-auth-jwt-module ${BUILD_FLAGS}
make modules
`
What is the error you're seeing, and what OS are you using (Mac?).
The BUILD_FLAGS
part is important because (currently) it allows for building on NGINX 1.23+ which has breaking changes from previous versions.
I would have to simulate it again. The system on which it threw an error has:
docker-compose version 1.29.1, build c34c88b2
Docker version 20.10.10, build b485636
The other system on which there isn't a problem are:
Docker Compose version v2.17.3
Docker version 23.0.5, build bc4487a
I haven't tried to reproduce the issue as it build with my modification to just automatically include that build flag because I am using an NGINX version greater then 1.23.0. I suspect it has something to do with the docker compose version on that machine and I'll upgrade it when I find some time.