|
1 | 1 | FROM nginx:1.19 |
2 | 2 |
|
| 3 | +# install build tools |
3 | 4 | RUN apt update \ |
4 | | - && apt install -y autoconf nginx build-essential gawk wget unzip \ |
5 | | - libssl-dev libpcre3-dev libzip-dev libxml2-dev libxslt-dev libgd-dev libgeoip-dev libperl-dev \ |
6 | | - gawk |
| 5 | + && apt install -y \ |
| 6 | + autoconf \ |
| 7 | + build-essential \ |
| 8 | + gawk \ |
| 9 | + libgd-dev \ |
| 10 | + libgeoip-dev \ |
| 11 | + libpcre3-dev \ |
| 12 | + libperl-dev \ |
| 13 | + libssl-dev \ |
| 14 | + libxml2-dev \ |
| 15 | + libxslt-dev \ |
| 16 | + libzip-dev \ |
| 17 | + nginx \ |
| 18 | + procps \ |
| 19 | + unzip \ |
| 20 | + wget \ |
| 21 | + gawk \ |
| 22 | + && apt-get clean \ |
| 23 | + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* |
7 | 24 |
|
8 | 25 | # get nginx redirection.io module sources |
9 | 26 | WORKDIR /tmp |
10 | | - |
11 | | -RUN wget -O libnginx-mod-redirectionio-master.zip https://github.com/redirectionio/libnginx-mod-redirectionio/archive/master.zip |
12 | | -RUN unzip libnginx-mod-redirectionio-master.zip |
| 27 | +RUN wget -O libnginx-mod-redirectionio-master.zip https://github.com/redirectionio/libnginx-mod-redirectionio/archive/master.zip \ |
| 28 | + && unzip libnginx-mod-redirectionio-master.zip |
13 | 29 |
|
14 | 30 | # get nginx sources |
15 | 31 | WORKDIR /root |
16 | | - |
17 | | -RUN NGINX_VERSION=`nginx -v 2>&1 | gawk 'match($0,/nginx version: nginx\/([0-9\.]+?)/,a) {print a[1]}'` && \ |
18 | | - echo $NGINX_VERSION && \ |
19 | | - wget http://nginx.org/download/nginx-$NGINX_VERSION.tar.gz && \ |
20 | | - tar -xzvf nginx-$NGINX_VERSION.tar.gz && \ |
21 | | - mv /root/nginx-$NGINX_VERSION /root/nginx && \ |
22 | | - rm nginx-$NGINX_VERSION.tar.gz |
| 32 | +RUN NGINX_VERSION=`nginx -v 2>&1 | gawk 'match($0,/nginx version: nginx\/([0-9\.]+?)/,a) {print a[1]}'` \ |
| 33 | + && echo $NGINX_VERSION \ |
| 34 | + && wget http://nginx.org/download/nginx-$NGINX_VERSION.tar.gz \ |
| 35 | + && tar -xzvf nginx-$NGINX_VERSION.tar.gz \ |
| 36 | + && mv /root/nginx-$NGINX_VERSION /root/nginx \ |
| 37 | + && rm nginx-$NGINX_VERSION.tar.gz |
23 | 38 |
|
24 | 39 | # install Rust |
25 | 40 | ENV RUSTUP_HOME=/opt/rust |
26 | 41 | ENV CARGO_HOME=/opt/rust |
27 | | - |
28 | 42 | RUN curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain 1.59.0 -y --no-modify-path |
29 | 43 | ENV PATH=/opt/rust/bin:$PATH |
30 | 44 | RUN mkdir -p /opt/rust/registry |
31 | 45 |
|
32 | 46 | # get libredirectionio sources |
33 | 47 | WORKDIR /tmp |
34 | | - |
35 | | -RUN wget -O libredirectionio-master.zip https://github.com/redirectionio/libredirectionio/archive/master.zip |
36 | | -RUN unzip libredirectionio-master.zip |
| 48 | +RUN wget -O libredirectionio-master.zip https://github.com/redirectionio/libredirectionio/archive/master.zip \ |
| 49 | + && unzip libredirectionio-master.zip |
37 | 50 |
|
38 | 51 | # build libredirectionio |
39 | 52 | WORKDIR /tmp/libredirectionio-master |
40 | | -RUN autoreconf -i && \ |
41 | | - ./configure && \ |
42 | | - make clean && \ |
43 | | - make && \ |
44 | | - make install |
| 53 | +RUN autoreconf -i \ |
| 54 | + && ./configure \ |
| 55 | + && make clean \ |
| 56 | + && make \ |
| 57 | + && make install |
45 | 58 |
|
46 | 59 | # build the module |
47 | 60 | WORKDIR /root/nginx |
48 | 61 |
|
49 | | -RUN NGINX_CONFIGURE_ARGUMENTS=`nginx -V 2>&1 | grep 'configure arguments:' | cut -d\ -f3- | sed "s/ --with-cc-opt='/ --with-cc-opt='-I\/tmp\/libredirectionio-master\/target /" | sed "s/ --with-ld-opt='/ --with-ld-opt='-L\/tmp\/libredirectionio-master\/target\/release /"` && \ |
50 | | - NGINX_MODULES_PATH=`nginx -V 2>&1 | gawk 'match($0,/--modules-path=(\S+?)/,a) {print a[1]}'` && \ |
51 | | - eval "./configure $NGINX_CONFIGURE_ARGUMENTS --add-dynamic-module=/tmp/libnginx-mod-redirectionio-master" && \ |
52 | | - make -j modules && \ |
53 | | - cp objs/ngx_http_redirectionio_module.so $NGINX_MODULES_PATH/ngx_http_redirectionio_module.so |
| 62 | +RUN NGINX_CONFIGURE_ARGUMENTS=`nginx -V 2>&1 | grep 'configure arguments:' | cut -d\ -f3- | sed "s/ --with-cc-opt='/ --with-cc-opt='-I\/tmp\/libredirectionio-master\/target /" | sed "s/ --with-ld-opt='/ --with-ld-opt='-L\/tmp\/libredirectionio-master\/target\/release /"` \ |
| 63 | + && NGINX_MODULES_PATH=`nginx -V 2>&1 | gawk 'match($0,/--modules-path=(\S+?)/,a) {print a[1]}'` \ |
| 64 | + && eval "./configure $NGINX_CONFIGURE_ARGUMENTS --add-dynamic-module=/tmp/libnginx-mod-redirectionio-master" \ |
| 65 | + && make -j modules \ |
| 66 | + && cp objs/ngx_http_redirectionio_module.so $NGINX_MODULES_PATH/ngx_http_redirectionio_module.so |
54 | 67 |
|
55 | 68 | # Configuration |
56 | 69 | COPY etc /etc |
0 commit comments