72 lines
2.4 KiB
HTTP
72 lines
2.4 KiB
HTTP
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
# Copyright © 2022 Thorsten Schubert <tschubert@bafh.org>
|
|
|
|
ARG NGINX_VERSION=1.27.0
|
|
FROM docker.io/library/nginx:${NGINX_VERSION}-alpine AS builder
|
|
|
|
ARG NGINX_VERSION=1.27.0
|
|
ARG HEADERS_MORE_VERSION=v0.37
|
|
|
|
COPY oci/sig/*.key /root/
|
|
|
|
RUN apk add --no-cache --virtual .build-deps \
|
|
autoconf \
|
|
automake \
|
|
curl \
|
|
g++ \
|
|
gcc \
|
|
git \
|
|
gpg \
|
|
gpg-agent \
|
|
libc-dev \
|
|
libtool \
|
|
linux-headers \
|
|
make \
|
|
openssl-dev \
|
|
pcre-dev \
|
|
shadow \
|
|
zlib-dev
|
|
|
|
WORKDIR /usr/src
|
|
|
|
RUN git clone --depth 1 -b ${HEADERS_MORE_VERSION} --single-branch https://github.com/openresty/headers-more-nginx-module.git \
|
|
&& cd headers-more-nginx-module \
|
|
&& git submodule update --init \
|
|
&& cd .. \
|
|
&& gpg --import /root/*.key \
|
|
&& curl -sL https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz -o nginx.tar.gz \
|
|
&& curl -sL https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz.asc -o nginx.tar.gz.asc \
|
|
&& gpg --status-fd 1 --verify nginx.tar.gz.asc 2>/dev/null \
|
|
&& tar zxfv nginx.tar.gz \
|
|
&& mv nginx-${NGINX_VERSION} nginx \
|
|
&& cd nginx \
|
|
&& ./configure --with-compat --add-dynamic-module=../headers-more-nginx-module \
|
|
&& make modules
|
|
|
|
|
|
FROM docker.io/library/nginx:${NGINX_VERSION}-alpine
|
|
|
|
ARG PUID=1000
|
|
ARG PGID=1000
|
|
|
|
COPY --from=builder /usr/src/nginx/objs/ngx_http_headers_more_filter_module.so /usr/lib/nginx/modules
|
|
|
|
RUN apk add --no-cache --virtual .build-deps shadow \
|
|
&& usermod -u ${PUID} nginx \
|
|
&& groupmod -g ${PGID} nginx \
|
|
&& apk del .build-deps \
|
|
&& sed -i 's,listen 80;,listen 8080;,' /etc/nginx/conf.d/default.conf \
|
|
&& sed -i '/user nginx;/d' /etc/nginx/nginx.conf \
|
|
&& sed -i 's,/var/run/nginx.pid,/tmp/nginx.pid,' /etc/nginx/nginx.conf \
|
|
&& sed -i "/^http {/a \ proxy_temp_path /tmp/proxy_temp;\n client_body_temp_path /tmp/client_temp;\n fastcgi_temp_path /tmp/fastcgi_temp;\n uwsgi_temp_path /tmp/uwsgi_temp;\n scgi_temp_path /tmp/scgi_temp;\n" /etc/nginx/nginx.conf \
|
|
&& chown -R ${PUID}:0 /var/cache/nginx /etc/nginx /var/log/nginx \
|
|
&& chmod -R g+w /var/cache/nginx /etc/nginx /var/log/nginx
|
|
|
|
COPY --chown=nginx:root oci/rootfs/http/etc/nginx/nginx.conf /etc/nginx/nginx.conf
|
|
COPY --chown=nginx:root oci/rootfs/http/usr/share/nginx/html/* /usr/share/nginx/html
|
|
|
|
USER $PUID
|
|
|
|
CMD ["nginx", "-g", "daemon off;"]
|
|
|
|
# vi: set ft=dockerfile ts=2 sw=2 sts=0 nosr et si tw=0 fdm=manual:
|