I am trying to set up nginx-clojure inside a docker container using alpine. I am using the latest versions for nginx (1.13.8) and nginx-clojure (0.4.5).
To do so, I am building nginx including the nginx-clojure module in the Dockerfile. The container images gets built correctly but when I try to run it I get:
This to me seemed like a permissions issues, but I have checked and I can see libjvm.so with the right permissions. I am not sure what could be the issue.
I also suspect it might be because of the ldd, but I am not sure what to do there. Any idea?
FROM openjdk:8u151-jdk-alpine3.7
RUN apk --update add pcre libbz2 ca-certificates libressl && rm /var/cache/apk/*
RUN adduser -h /etc/nginx -D -s /bin/sh nginx && mkdir /jars
WORKDIR /tmp
ENV NGINX_VERSION=1.13.8
# add compilation env, build required C based gems and cleanup
RUN apk --update add --virtual build_deps build-base zlib-dev pcre-dev libressl-dev \
&& ls -als nginx-clojure-0.4.5/ \
&& cd nginx-$NGINX_VERSION && ./configure \
--prefix=/usr/share/nginx \
--sbin-path=/usr/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=stderr \
--http-log-path=/dev/stdout \
--pid-path=/var/run/nginx.pid \
--lock-path=/var/run/nginx.lock \
--http-client-body-temp-path=/var/cache/nginx/client_temp \
--http-proxy-temp-path=/var/cache/nginx/proxy_temp \
--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \
--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \
--http-scgi-temp-path=/var/cache/nginx/scgi_temp \
--user=nginx \
--group=nginx \
--with-http_addition_module \
--with-http_auth_request_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_realip_module \
--with-http_ssl_module \
--with-http_stub_status_module \
--with-http_sub_module \
--with-http_v2_module \
--with-threads \
--with-stream \
--with-stream_ssl_module \
--without-http_memcached_module \
--without-mail_pop3_module \
--without-mail_imap_module \
--without-mail_smtp_module \
--with-pcre-jit \
--with-cc-opt='-g -O2 -fstack-protector-strong -Wformat -Werror=format-security' \
--with-ld-opt='-Wl,-z,relro -Wl,--as-needed' \
--add-module=../nginx-clojure-0.4.5/src/c \
&& make install \
&& cd .. && rm -rf nginx-$NGINX_VERSION \
&& mkdir /var/cache/nginx \
&& rm /etc/nginx/*.default \
&& apk del build_deps && rm /var/cache/apk/*
COPY nginx.conf /etc/nginx/
ADD conf.d /etc/nginx/conf.d
ADD nginx-dynamic-proxy-1.0-SNAPSHOT.jar /jars/nginx-dynamic-proxy-1.0-SNAPSHOT.jar
RUN chown -R nginx:nginx /jars && chmod 644 /jars/nginx-dynamic-proxy-1.0-SNAPSHOT.jar
VOLUME ["/var/cache/nginx"]
EXPOSE 80 443
CMD ["nginx", "-g", "daemon off;"]
worker_processes 1;
events {
worker_connections 1024;
}
user root;
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
#gzip on;
jvm_path "/usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64/server/libjvm.so";
jvm_classpath "/jars/*";
jvm_options "-Xdebug";
#jvm_handler_type 'java';
#jvm_init_handler_name 'com.nap.nginx.NginxInitializationHandler';
#jvm_exit_handler_name 'com.nap.nginx.NginxExitHandler';
server {
listen 8080;
location / {
set $endpoint "";
rewrite_handler_type 'java';
rewrite_handler_name 'some.package.NginxHandlers.DynamicProxyPassHandler';
proxy_pass http://$endpoint;
}
}
}
docker run -p 8080:8080 -v "$(pwd)/nginx_java.conf:/etc/nginx/nginx.conf" c5761456cd6c
Any help would be appreciated. Thanks.