diff --git a/Dockerfile b/Dockerfile index d30716e..aad4ea4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,19 +4,6 @@ FROM debian:${IMAGE_BASE_TAG} ARG RESTY_VERSION="1.19.3.1" -RUN apt-get update && apt-get -y upgrade \ -&& rm -rf /var/lib/apt/lists/* - -# Install all required packages -RUN apt-get update && \ - apt-get install -y \ - build-essential \ - wget \ - curl \ - unzip \ - gzip \ - && rm -rf /var/lib/apt/lists/* - ARG RESTY_CONFIG_OPTIONS="\ --with-compat \ --with-file-aio \ @@ -52,29 +39,33 @@ ARG RESTY_CONFIG_OPTIONS="\ WORKDIR /tmp # Get the openresty /nginx source RUN cd /tmp -#RUN curl -fSL https://openresty.org/download/openresty-${RESTY_VERSION}.tar.gz -o openresty.tar.gz \ -# && tar xvf openresty.tar.gz - -RUN wget https://openresty.org/download/openresty-1.19.3.1.tar.gz -O openresty.tar.gz \ - && tar xvf openresty.tar.gz && mv openresty-1.19.3.1 openresty -RUN ls -RUN wget https://github.com/kvspb/nginx-auth-ldap/archive/refs/heads/master.zip && unzip -o master.zip && rm master.zip -RUN apt-get update && \ - apt-get install -y libpcre3-dev \ +# Install all required packages +RUN apt-get update \ + && apt-get -y upgrade \ + && apt-get install -y \ + build-essential \ + wget \ + curl \ + unzip \ + gzip \ + && apt-get install -y libpcre3-dev \ libssl-dev zlib1g-dev libxslt-dev \ libgd-dev libgeoip-dev libldap2-dev\ - && rm -rf /var/lib/apt/lists/* - -RUN cd openresty && \ - ./configure ${RESTY_CONFIG_OPTIONS} \ - && make && make install -RUN ln -sf /dev/stdout /usr/local/openresty/nginx/logs/access.log \ + && apt-get install -y procps luarocks \ + && rm -rf /var/lib/apt/lists/* \ + && wget https://openresty.org/download/openresty-1.19.3.1.tar.gz -O openresty.tar.gz \ + && tar xvf openresty.tar.gz && mv openresty-1.19.3.1 openresty \ + && wget https://github.com/kvspb/nginx-auth-ldap/archive/refs/heads/master.zip && unzip -o master.zip && rm master.zip \ + \ + && cd openresty \ + && ./configure ${RESTY_CONFIG_OPTIONS} \ + && make && make install \ + && ln -sf /dev/stdout /usr/local/openresty/nginx/logs/access.log \ && ln -sf /dev/stderr /usr/local/openresty/nginx/logs/error.log \ - && mkdir -p /var/run/openresty - -RUN apt-get update && \ - apt-get install -y procps luarocks \ - && rm -rf /var/lib/apt/lists/* + && mkdir -p /var/run/openresty \ + && cd /usr/local \ + && rm -rf /tmp/* + COPY nginx.conf /usr/local/openresty/nginx/conf/nginx.conf #RUN apt-get install liblua5.3-dev WORKDIR /usr/local/openresty diff --git a/docker-compose.yml b/docker-compose.yml index b63e288..c076920 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,7 +11,6 @@ services: image: docker.triton2.fet.at/openrestyfet:latest ports: - "8081:8080" - theiaconf: image: docker.triton2.fet.at/dev_theia volumes: diff --git a/snippets/add_auto_ssl.conf b/snippets/add_auto_ssl.conf new file mode 100644 index 0000000..5f765d1 --- /dev/null +++ b/snippets/add_auto_ssl.conf @@ -0,0 +1,14 @@ +ssl_certificate_by_lua_block { + auto_ssl:ssl_certificate() +} + + # You must still define a static ssl_certificate file for nginx to start. + # + # You may generate a self-signed fallback with: + # + # openssl req -new -newkey rsa:2048 -days 3650 -nodes -x509 \ + # -subj '/CN=sni-support-required-for-valid-ssl' \ + # -keyout /etc/ssl/resty-auto-ssl-fallback.key \ + # -out /etc/ssl/resty-auto-ssl-fallback.crt +ssl_certificate /etc/ssl/resty-auto-ssl-fallback.crt; +ssl_certificate_key /etc/ssl/resty-auto-ssl-fallback.key; \ No newline at end of file diff --git a/snippets/auto_ssl.conf b/snippets/auto_ssl.conf index 5f765d1..5f7753c 100644 --- a/snippets/auto_ssl.conf +++ b/snippets/auto_ssl.conf @@ -1,14 +1,5 @@ -ssl_certificate_by_lua_block { - auto_ssl:ssl_certificate() -} - - # You must still define a static ssl_certificate file for nginx to start. - # - # You may generate a self-signed fallback with: - # - # openssl req -new -newkey rsa:2048 -days 3650 -nodes -x509 \ - # -subj '/CN=sni-support-required-for-valid-ssl' \ - # -keyout /etc/ssl/resty-auto-ssl-fallback.key \ - # -out /etc/ssl/resty-auto-ssl-fallback.crt -ssl_certificate /etc/ssl/resty-auto-ssl-fallback.crt; -ssl_certificate_key /etc/ssl/resty-auto-ssl-fallback.key; \ No newline at end of file +location /.well-known/acme-challenge/ { + content_by_lua_block { + auto_ssl:challenge_server() + } + } \ No newline at end of file diff --git a/snippets/get_auto_ssl.conf b/snippets/get_auto_ssl.conf deleted file mode 100644 index 5f7753c..0000000 --- a/snippets/get_auto_ssl.conf +++ /dev/null @@ -1,5 +0,0 @@ -location /.well-known/acme-challenge/ { - content_by_lua_block { - auto_ssl:challenge_server() - } - } \ No newline at end of file diff --git a/snippets/private.conf b/snippets/private.conf new file mode 100644 index 0000000..f2f5f50 --- /dev/null +++ b/snippets/private.conf @@ -0,0 +1 @@ +include ldap.conf; \ No newline at end of file diff --git a/snippets/secure.conf b/snippets/secure.conf new file mode 100644 index 0000000..9dfdede --- /dev/null +++ b/snippets/secure.conf @@ -0,0 +1 @@ +include add_auto_ssl.conf; \ No newline at end of file