Skip to content

Commit 50d8dfc

Browse files
authored
Merge pull request #1 from nginxinc/master
Dev
2 parents 1eea9f7 + 0dd9ef6 commit 50d8dfc

File tree

11 files changed

+580
-22
lines changed

11 files changed

+580
-22
lines changed

Dockerfile

Lines changed: 0 additions & 22 deletions
This file was deleted.

LICENSE

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Copyright (C) 2011-2016 Nginx, Inc.
2+
All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without
5+
modification, are permitted provided that the following conditions
6+
are met:
7+
1. Redistributions of source code must retain the above copyright
8+
notice, this list of conditions and the following disclaimer.
9+
2. Redistributions in binary form must reproduce the above copyright
10+
notice, this list of conditions and the following disclaimer in the
11+
documentation and/or other materials provided with the distribution.
12+
13+
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16+
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19+
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20+
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21+
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22+
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23+
SUCH DAMAGE.

generate-stackbrew-library.sh

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
#!/bin/bash
2+
set -eu
3+
4+
declare -A aliases
5+
aliases=(
6+
[mainline]='1 1.11 latest'
7+
[stable]='1.10'
8+
)
9+
10+
self="$(basename "$BASH_SOURCE")"
11+
cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"
12+
base=jessie
13+
14+
versions=( */ )
15+
versions=( "${versions[@]%/}" )
16+
17+
# get the most recent commit which modified any of "$@"
18+
fileCommit() {
19+
git log -1 --format='format:%H' HEAD -- "$@"
20+
}
21+
22+
# get the most recent commit which modified "$1/Dockerfile" or any file COPY'd from "$1/Dockerfile"
23+
dirCommit() {
24+
local dir="$1"; shift
25+
(
26+
cd "$dir"
27+
fileCommit \
28+
Dockerfile \
29+
$(git show HEAD:./Dockerfile | awk '
30+
toupper($1) == "COPY" {
31+
for (i = 2; i < NF; i++) {
32+
print $i
33+
}
34+
}
35+
')
36+
)
37+
}
38+
39+
cat <<-EOH
40+
# this file is generated via https://github.com/nginxinc/docker-nginx/blob/$(fileCommit "$self")/$self
41+
42+
Maintainers: NGINX Docker Maintainers <[email protected]> (@nginxinc)
43+
GitRepo: https://github.com/nginxinc/docker-nginx.git
44+
EOH
45+
46+
# prints "$2$1$3$1...$N"
47+
join() {
48+
local sep="$1"; shift
49+
local out; printf -v out "${sep//%/%%}%s" "$@"
50+
echo "${out#$sep}"
51+
}
52+
53+
for version in "${versions[@]}"; do
54+
commit="$(dirCommit "$version/$base")"
55+
56+
fullVersion="$(git show "$commit":"$version/$base/Dockerfile" | awk '$1 == "ENV" && $2 == "NGINX_VERSION" { print $3; exit }')"
57+
fullVersion="${fullVersion%[.-]*}"
58+
59+
versionAliases=( $fullVersion )
60+
if [ "$version" != "$fullVersion" ]; then
61+
versionAliases+=( $version )
62+
fi
63+
versionAliases+=( ${aliases[$version]:-} )
64+
65+
echo
66+
cat <<-EOE
67+
Tags: $(join ', ' "${versionAliases[@]}")
68+
GitCommit: $commit
69+
Directory: $version/$base
70+
EOE
71+
72+
for variant in alpine; do
73+
commit="$(dirCommit "$version/$variant")"
74+
75+
variantAliases=( "${versionAliases[@]/%/-$variant}" )
76+
variantAliases=( "${variantAliases[@]//latest-/}" )
77+
78+
echo
79+
cat <<-EOE
80+
Tags: $(join ', ' "${variantAliases[@]}")
81+
GitCommit: $commit
82+
Directory: $version/$variant
83+
EOE
84+
done
85+
done

mainline/alpine/Dockerfile

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
FROM alpine:3.4
2+
3+
MAINTAINER NGINX Docker Maintainers "[email protected]"
4+
5+
ENV NGINX_VERSION 1.11.4
6+
7+
RUN GPG_KEYS=B0F4253373F8F6F510D42178520A9993A1C052F8 \
8+
&& CONFIG="\
9+
--prefix=/etc/nginx \
10+
--sbin-path=/usr/sbin/nginx \
11+
--modules-path=/usr/lib/nginx/modules \
12+
--conf-path=/etc/nginx/nginx.conf \
13+
--error-log-path=/var/log/nginx/error.log \
14+
--http-log-path=/var/log/nginx/access.log \
15+
--pid-path=/var/run/nginx.pid \
16+
--lock-path=/var/run/nginx.lock \
17+
--http-client-body-temp-path=/var/cache/nginx/client_temp \
18+
--http-proxy-temp-path=/var/cache/nginx/proxy_temp \
19+
--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \
20+
--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \
21+
--http-scgi-temp-path=/var/cache/nginx/scgi_temp \
22+
--user=nginx \
23+
--group=nginx \
24+
--with-http_ssl_module \
25+
--with-http_realip_module \
26+
--with-http_addition_module \
27+
--with-http_sub_module \
28+
--with-http_dav_module \
29+
--with-http_flv_module \
30+
--with-http_mp4_module \
31+
--with-http_gunzip_module \
32+
--with-http_gzip_static_module \
33+
--with-http_random_index_module \
34+
--with-http_secure_link_module \
35+
--with-http_stub_status_module \
36+
--with-http_auth_request_module \
37+
--with-http_xslt_module=dynamic \
38+
--with-http_image_filter_module=dynamic \
39+
--with-http_geoip_module=dynamic \
40+
--with-http_perl_module=dynamic \
41+
--with-threads \
42+
--with-stream \
43+
--with-stream_ssl_module \
44+
--with-stream_realip_module \
45+
--with-stream_geoip_module=dynamic \
46+
--with-http_slice_module \
47+
--with-mail \
48+
--with-mail_ssl_module \
49+
--with-file-aio \
50+
--with-http_v2_module \
51+
--with-ipv6 \
52+
" \
53+
&& addgroup -S nginx \
54+
&& adduser -D -S -h /var/cache/nginx -s /sbin/nologin -G nginx nginx \
55+
&& apk add --no-cache --virtual .build-deps \
56+
gcc \
57+
libc-dev \
58+
make \
59+
openssl-dev \
60+
pcre-dev \
61+
zlib-dev \
62+
linux-headers \
63+
curl \
64+
gnupg \
65+
libxslt-dev \
66+
gd-dev \
67+
geoip-dev \
68+
perl-dev \
69+
&& curl -fSL http://nginx.org/download/nginx-$NGINX_VERSION.tar.gz -o nginx.tar.gz \
70+
&& curl -fSL http://nginx.org/download/nginx-$NGINX_VERSION.tar.gz.asc -o nginx.tar.gz.asc \
71+
&& export GNUPGHOME="$(mktemp -d)" \
72+
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEYS" \
73+
&& gpg --batch --verify nginx.tar.gz.asc nginx.tar.gz \
74+
&& rm -r "$GNUPGHOME" nginx.tar.gz.asc \
75+
&& mkdir -p /usr/src \
76+
&& tar -zxC /usr/src -f nginx.tar.gz \
77+
&& rm nginx.tar.gz \
78+
&& cd /usr/src/nginx-$NGINX_VERSION \
79+
&& ./configure $CONFIG --with-debug \
80+
&& make -j$(getconf _NPROCESSORS_ONLN) \
81+
&& mv objs/nginx objs/nginx-debug \
82+
&& mv objs/ngx_http_xslt_filter_module.so objs/ngx_http_xslt_filter_module-debug.so \
83+
&& mv objs/ngx_http_image_filter_module.so objs/ngx_http_image_filter_module-debug.so \
84+
&& mv objs/ngx_http_geoip_module.so objs/ngx_http_geoip_module-debug.so \
85+
&& mv objs/ngx_http_perl_module.so objs/ngx_http_perl_module-debug.so \
86+
&& mv objs/ngx_stream_geoip_module.so objs/ngx_stream_geoip_module-debug.so \
87+
&& ./configure $CONFIG \
88+
&& make -j$(getconf _NPROCESSORS_ONLN) \
89+
&& make install \
90+
&& rm -rf /etc/nginx/html/ \
91+
&& mkdir /etc/nginx/conf.d/ \
92+
&& mkdir -p /usr/share/nginx/html/ \
93+
&& install -m644 html/index.html /usr/share/nginx/html/ \
94+
&& install -m644 html/50x.html /usr/share/nginx/html/ \
95+
&& install -m755 objs/nginx-debug /usr/sbin/nginx-debug \
96+
&& install -m755 objs/ngx_http_xslt_filter_module-debug.so /usr/lib/nginx/modules/ngx_http_xslt_filter_module-debug.so \
97+
&& install -m755 objs/ngx_http_image_filter_module-debug.so /usr/lib/nginx/modules/ngx_http_image_filter_module-debug.so \
98+
&& install -m755 objs/ngx_http_geoip_module-debug.so /usr/lib/nginx/modules/ngx_http_geoip_module-debug.so \
99+
&& install -m755 objs/ngx_http_perl_module-debug.so /usr/lib/nginx/modules/ngx_http_perl_module-debug.so \
100+
&& install -m755 objs/ngx_stream_geoip_module-debug.so /usr/lib/nginx/modules/ngx_stream_geoip_module-debug.so \
101+
&& ln -s ../../usr/lib/nginx/modules /etc/nginx/modules \
102+
&& strip /usr/sbin/nginx* \
103+
&& strip /usr/lib/nginx/modules/*.so \
104+
&& rm -rf /usr/src/nginx-$NGINX_VERSION \
105+
\
106+
# Bring in gettext so we can get `envsubst`, then throw
107+
# the rest away. To do this, we need to install `gettext`
108+
# then move `envsubst` out of the way so `gettext` can
109+
# be deleted completely, then move `envsubst` back.
110+
&& apk add --no-cache --virtual .gettext gettext \
111+
&& mv /usr/bin/envsubst /tmp/ \
112+
\
113+
&& runDeps="$( \
114+
scanelf --needed --nobanner /usr/sbin/nginx /usr/lib/nginx/modules/*.so /tmp/envsubst \
115+
| awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
116+
| sort -u \
117+
| xargs -r apk info --installed \
118+
| sort -u \
119+
)" \
120+
&& apk add --no-cache --virtual .nginx-rundeps $runDeps \
121+
&& apk del .build-deps \
122+
&& apk del .gettext \
123+
&& mv /tmp/envsubst /usr/local/bin/ \
124+
\
125+
# forward request and error logs to docker log collector
126+
&& ln -sf /dev/stdout /var/log/nginx/access.log \
127+
&& ln -sf /dev/stderr /var/log/nginx/error.log
128+
129+
COPY nginx.conf /etc/nginx/nginx.conf
130+
COPY nginx.vh.default.conf /etc/nginx/conf.d/default.conf
131+
132+
EXPOSE 80 443
133+
134+
CMD ["nginx", "-g", "daemon off;"]

mainline/alpine/nginx.conf

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
2+
user nginx;
3+
worker_processes 1;
4+
5+
error_log /var/log/nginx/error.log warn;
6+
pid /var/run/nginx.pid;
7+
8+
9+
events {
10+
worker_connections 1024;
11+
}
12+
13+
14+
http {
15+
include /etc/nginx/mime.types;
16+
default_type application/octet-stream;
17+
18+
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
19+
'$status $body_bytes_sent "$http_referer" '
20+
'"$http_user_agent" "$http_x_forwarded_for"';
21+
22+
access_log /var/log/nginx/access.log main;
23+
24+
sendfile on;
25+
#tcp_nopush on;
26+
27+
keepalive_timeout 65;
28+
29+
#gzip on;
30+
31+
include /etc/nginx/conf.d/*.conf;
32+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
server {
2+
listen 80;
3+
server_name localhost;
4+
5+
#charset koi8-r;
6+
#access_log /var/log/nginx/log/host.access.log main;
7+
8+
location / {
9+
root /usr/share/nginx/html;
10+
index index.html index.htm;
11+
}
12+
13+
#error_page 404 /404.html;
14+
15+
# redirect server error pages to the static page /50x.html
16+
#
17+
error_page 500 502 503 504 /50x.html;
18+
location = /50x.html {
19+
root /usr/share/nginx/html;
20+
}
21+
22+
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
23+
#
24+
#location ~ \.php$ {
25+
# proxy_pass http://127.0.0.1;
26+
#}
27+
28+
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
29+
#
30+
#location ~ \.php$ {
31+
# root html;
32+
# fastcgi_pass 127.0.0.1:9000;
33+
# fastcgi_index index.php;
34+
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
35+
# include fastcgi_params;
36+
#}
37+
38+
# deny access to .htaccess files, if Apache's document root
39+
# concurs with nginx's one
40+
#
41+
#location ~ /\.ht {
42+
# deny all;
43+
#}
44+
}
45+

mainline/jessie/Dockerfile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
FROM debian:jessie
2+
3+
MAINTAINER NGINX Docker Maintainers "[email protected]"
4+
5+
ENV NGINX_VERSION 1.11.4-1~jessie
6+
7+
RUN apt-key adv --keyserver hkp://pgp.mit.edu:80 --recv-keys 573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62 \
8+
&& echo "deb http://nginx.org/packages/mainline/debian/ jessie nginx" >> /etc/apt/sources.list \
9+
&& apt-get update \
10+
&& apt-get install --no-install-recommends --no-install-suggests -y \
11+
ca-certificates \
12+
nginx=${NGINX_VERSION} \
13+
nginx-module-xslt \
14+
nginx-module-geoip \
15+
nginx-module-image-filter \
16+
nginx-module-perl \
17+
nginx-module-njs \
18+
gettext-base \
19+
&& rm -rf /var/lib/apt/lists/*
20+
21+
# forward request and error logs to docker log collector
22+
RUN ln -sf /dev/stdout /var/log/nginx/access.log \
23+
&& ln -sf /dev/stderr /var/log/nginx/error.log
24+
25+
EXPOSE 80 443
26+
27+
CMD ["nginx", "-g", "daemon off;"]

0 commit comments

Comments
 (0)