This repository has been archived by the owner on Dec 10, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from amiri27/fix-get-gpg
Port changes to Dockerfile from upstream
- Loading branch information
Showing
1 changed file
with
39 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ FROM alpine:3.7 | |
|
||
LABEL maintainer="[email protected]" | ||
|
||
ENV NGINX_VERSION 1.13.6 | ||
ENV NGINX_VERSION 1.13.11 | ||
ENV NCHAN_VERSION 1.1.5 | ||
|
||
RUN GPG_KEYS=B0F4253373F8F6F510D42178520A9993A1C052F8 \ | ||
|
@@ -38,16 +38,18 @@ RUN GPG_KEYS=B0F4253373F8F6F510D42178520A9993A1C052F8 \ | |
--with-http_xslt_module=dynamic \ | ||
--with-http_image_filter_module=dynamic \ | ||
--with-http_geoip_module=dynamic \ | ||
--with-http_perl_module=dynamic \ | ||
--with-threads \ | ||
--with-stream \ | ||
--with-stream_ssl_module \ | ||
--with-stream_ssl_preread_module \ | ||
--with-stream_realip_module \ | ||
--with-stream_geoip_module=dynamic \ | ||
--with-http_slice_module \ | ||
--with-mail \ | ||
--with-mail_ssl_module \ | ||
--with-compat \ | ||
--with-file-aio \ | ||
--with-http_v2_module \ | ||
--with-ipv6 \ | ||
--add-dynamic-module=/usr/src/nchan-${NCHAN_VERSION} \ | ||
" \ | ||
&& addgroup -S nginx \ | ||
|
@@ -65,30 +67,39 @@ RUN GPG_KEYS=B0F4253373F8F6F510D42178520A9993A1C052F8 \ | |
libxslt-dev \ | ||
gd-dev \ | ||
geoip-dev \ | ||
perl-dev \ | ||
&& curl -fSL http://nginx.org/download/nginx-$NGINX_VERSION.tar.gz -o nginx.tar.gz \ | ||
&& curl -fSL http://nginx.org/download/nginx-$NGINX_VERSION.tar.gz.asc -o nginx.tar.gz.asc \ | ||
&& curl -fSL https://nginx.org/download/nginx-$NGINX_VERSION.tar.gz -o nginx.tar.gz \ | ||
&& curl -fSL https://nginx.org/download/nginx-$NGINX_VERSION.tar.gz.asc -o nginx.tar.gz.asc \ | ||
&& curl -fSL https://github.com/slact/nchan/archive/v${NCHAN_VERSION}.tar.gz -o nchan.tar.gz \ | ||
&& export GNUPGHOME="$(mktemp -d)" \ | ||
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEYS" \ | ||
&& gpg --batch --verify nginx.tar.gz.asc nginx.tar.gz \ | ||
&& rm -r "$GNUPGHOME" nginx.tar.gz.asc \ | ||
&& found=''; \ | ||
for server in \ | ||
ha.pool.sks-keyservers.net \ | ||
hkp://keyserver.ubuntu.com:80 \ | ||
hkp://p80.pool.sks-keyservers.net:80 \ | ||
pgp.mit.edu \ | ||
; do \ | ||
echo "Fetching GPG key $GPG_KEYS from $server"; \ | ||
gpg --keyserver "$server" --keyserver-options timeout=10 --recv-keys "$GPG_KEYS" && found=yes && break; \ | ||
done; \ | ||
test -z "$found" && echo >&2 "error: failed to fetch GPG key $GPG_KEYS" && exit 1; \ | ||
gpg --batch --verify nginx.tar.gz.asc nginx.tar.gz \ | ||
&& rm -rf "$GNUPGHOME" nginx.tar.gz.asc \ | ||
&& mkdir -p /usr/src \ | ||
&& tar -zxC /usr/src -f nginx.tar.gz \ | ||
&& tar -zxC /usr/src -f nchan.tar.gz \ | ||
&& rm nginx.tar.gz \ | ||
&& rm nchan.tar.gz \ | ||
&& cd /usr/src/nginx-$NGINX_VERSION \ | ||
&& ./configure $CONFIG --with-debug \ | ||
&& make \ | ||
&& make -j$(getconf _NPROCESSORS_ONLN) \ | ||
&& mv objs/nginx objs/nginx-debug \ | ||
&& mv objs/ngx_http_xslt_filter_module.so objs/ngx_http_xslt_filter_module-debug.so \ | ||
&& mv objs/ngx_http_image_filter_module.so objs/ngx_http_image_filter_module-debug.so \ | ||
&& mv objs/ngx_http_geoip_module.so objs/ngx_http_geoip_module-debug.so \ | ||
&& mv objs/ngx_http_perl_module.so objs/ngx_http_perl_module-debug.so \ | ||
&& mv objs/ngx_stream_geoip_module.so objs/ngx_stream_geoip_module-debug.so \ | ||
&& mv objs/ngx_nchan_module.so objs/ngx_nchan_module-debug.so \ | ||
&& ./configure $CONFIG \ | ||
&& make \ | ||
&& make -j$(getconf _NPROCESSORS_ONLN) \ | ||
&& make install \ | ||
&& rm -rf /etc/nginx/html/ \ | ||
&& mkdir /etc/nginx/conf.d/ \ | ||
|
@@ -99,39 +110,44 @@ RUN GPG_KEYS=B0F4253373F8F6F510D42178520A9993A1C052F8 \ | |
&& install -m755 objs/ngx_http_xslt_filter_module-debug.so /usr/lib/nginx/modules/ngx_http_xslt_filter_module-debug.so \ | ||
&& install -m755 objs/ngx_http_image_filter_module-debug.so /usr/lib/nginx/modules/ngx_http_image_filter_module-debug.so \ | ||
&& install -m755 objs/ngx_http_geoip_module-debug.so /usr/lib/nginx/modules/ngx_http_geoip_module-debug.so \ | ||
&& install -m755 objs/ngx_http_perl_module-debug.so /usr/lib/nginx/modules/ngx_http_perl_module-debug.so \ | ||
&& install -m755 objs/ngx_stream_geoip_module-debug.so /usr/lib/nginx/modules/ngx_stream_geoip_module-debug.so \ | ||
&& install -m755 objs/ngx_nchan_module-debug.so /usr/lib/nginx/modules/ngx_nchan_module-debug.so \ | ||
&& ln -s ../../usr/lib/nginx/modules /etc/nginx/modules \ | ||
&& strip /usr/sbin/nginx* \ | ||
&& strip /usr/lib/nginx/modules/*.so \ | ||
&& rm -rf /usr/src/nginx-$NGINX_VERSION \ | ||
# | ||
&& rm -rf /usr/src/nginx-$NGINX_VERSION /usr/src/nchan-${NCHAN_VERSION} \ | ||
\ | ||
# Bring in gettext so we can get `envsubst`, then throw | ||
# the rest away. To do this, we need to install `gettext` | ||
# then move `envsubst` out of the way so `gettext` can | ||
# be deleted completely, then move `envsubst` back. | ||
&& apk add --no-cache --virtual .gettext gettext \ | ||
&& mv /usr/bin/envsubst /tmp/ \ | ||
# | ||
\ | ||
&& runDeps="$( \ | ||
scanelf --needed --nobanner /usr/sbin/nginx /usr/lib/nginx/modules/*.so /tmp/envsubst \ | ||
| awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \ | ||
| sort -u \ | ||
| xargs -r apk info --installed \ | ||
scanelf --needed --nobanner --format '%n#p' /usr/sbin/nginx /usr/lib/nginx/modules/*.so /tmp/envsubst \ | ||
| tr ',' '\n' \ | ||
| sort -u \ | ||
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ | ||
)" \ | ||
&& apk add --no-cache --virtual .nginx-rundeps $runDeps \ | ||
&& apk del .build-deps \ | ||
&& apk del .gettext \ | ||
&& mv /tmp/envsubst /usr/bin/ \ | ||
# | ||
&& mv /tmp/envsubst /usr/local/bin/ \ | ||
\ | ||
# Bring in tzdata so users could set the timezones through the environment | ||
# variables | ||
&& apk add --no-cache tzdata \ | ||
\ | ||
# forward request and error logs to docker log collector | ||
&& ln -sf /dev/stdout /var/log/nginx/access.log \ | ||
&& ln -sf /dev/stderr /var/log/nginx/error.log | ||
|
||
COPY nginx.conf /etc/nginx/nginx.conf | ||
COPY nginx.vh.default.conf /etc/nginx/conf.d/default.conf | ||
|
||
EXPOSE 80 443 | ||
EXPOSE 80 | ||
|
||
STOPSIGNAL SIGTERM | ||
|
||
CMD ["nginx", "-g", "daemon off;"] |