@@ -2,63 +2,62 @@ FROM centos:7
2
2
3
3
MAINTAINER Tesla Government email:
[email protected]
4
4
5
- RUN yum -y update
5
+ ENV LD_LIBRARY_PATH=/usr/local/lib
6
6
7
- RUN yum -y groupinstall 'Development Tools'
8
- RUN yum -y install pcre-devel pcre
9
- RUN yum -y install zlib-devel openssl-devel
10
- RUN yum -y install wget
11
- RUN yum -y install cmake
12
- RUN yum -y install check-devel check
13
- # RUN yum -y install subunit-devel subunit libsubunit
7
+ COPY ./resources/nginx.repo /etc/yum.repos.d/nginx.repo
8
+
9
+ RUN yum -y update && \
10
+ yum -y groupinstall 'Development Tools' && \
11
+ yum -y install pcre-devel pcre zlib-devel openssl-devel wget cmake check-devel check
14
12
15
13
RUN mkdir -p /root/dl
14
+ WORKDIR /root/dl
16
15
17
16
# get our JWT module
18
- WORKDIR /root/dl
19
17
# change this to get a specific version?
20
- RUN wget https://github.com/TeslaGov/ngx-http-auth-jwt-module/archive/master.zip
21
- RUN unzip master.zip
22
- RUN rm master.zip
23
- RUN ln -sf ngx-http-auth-jwt-module-master ngx-http-auth-jwt-module
18
+ RUN wget https://github.com/TeslaGov/ngx-http-auth-jwt-module/archive/master.zip && \
19
+ unzip master.zip && \
20
+ rm master.zip && \
21
+ ln -sf ngx-http-auth-jwt-module-master ngx-http-auth-jwt-module
24
22
25
23
# build jansson
26
- WORKDIR /root/dl
27
- RUN wget https://github.com/akheron/jansson/archive/v2.10.zip
28
- RUN unzip v2.10.zip
29
- RUN rm v2.10.zip
30
- RUN ln -sf jansson-2.10 jansson
31
- WORKDIR /root/dl/jansson
32
- RUN cmake .
33
- RUN make
34
- RUN make check
35
- RUN make install
24
+ RUN wget https://github.com/akheron/jansson/archive/v2.10.zip && \
25
+ unzip v2.10.zip && \
26
+ rm v2.10.zip && \
27
+ ln -sf jansson-2.10 jansson && \
28
+ cd /root/dl/jansson && \
29
+ cmake . -DJANSSON_BUILD_SHARED_LIBS=1 -DJANSSON_BUILD_DOCS=OFF &&
30
+ make && \
31
+ make check && \
32
+ make install
36
33
37
34
# build libjwt
38
- WORKDIR /root/dl
39
- RUN wget https://github.com/benmcollins/libjwt/archive/v1.8.0.zip
40
- RUN unzip v1.8.0.zip
41
- RUN rm v1.8.0.zip
42
- RUN ln -sf libjwt-1.8.0 libjwt
43
- WORKDIR /root/dl/libjwt
44
- RUN autoreconf -i
45
- RUN ./configure JANSSON_CFLAGS=/usr/local/include JANSSON_LIBS=/usr/local/lib
46
- RUN make all
47
- # this does not work because it can't find JANSSON
48
- # RUN make check
49
- RUN make install
50
-
51
- WORKDIR /root/dl
52
- RUN wget http://nginx.org/download/nginx-1.12.0.tar.gz
53
- RUN tar -xzf nginx-1.12.0.tar.gz
54
- RUN rm nginx-1.12.0.tar.gz
55
- RUN ln -sf nginx-1.12.0 nginx
56
- WORKDIR /root/dl/nginx
57
- RUN ./configure --with-compat --add-dynamic-module=../ngx-http-auth-jwt-module --with-cc-opt='-std=gnu99'
58
- RUN make modules
59
-
60
-
61
- EXPOSE 80
62
- VOLUME ["/etc/nginx/sites-enabled" , "/etc/nginx/certs" , "/etc/nginx/conf.d" , "/var/log/nginx" , "/var/www/html" ]
63
- WORKDIR /etc/nginx
35
+ RUN wget https://github.com/benmcollins/libjwt/archive/v1.8.0.zip && \
36
+ unzip v1.8.0.zip && \
37
+ rm v1.8.0.zip && \
38
+ ln -sf libjwt-1.8.0 libjwt && \
39
+ cd /root/dl/libjwt && \
40
+ autoreconf -i && \
41
+ ./configure JANSSON_CFLAGS=/usr/local/include JANSSON_LIBS=/usr/local/lib && \
42
+ make all && \
43
+ make install
44
+
45
+ # build nginx module against nginx sources
46
+ RUN wget http://nginx.org/download/nginx-1.12.0.tar.gz && \
47
+ tar -xzf nginx-1.12.0.tar.gz && \
48
+ rm nginx-1.12.0.tar.gz && \
49
+ ln -sf nginx-1.12.0 nginx && \
50
+ cd /root/dl/nginx && \
51
+ ./configure --with-compat --add-dynamic-module=../ngx-http-auth-jwt-module --with-cc-opt='-std=gnu99' && \
52
+ make modules
53
+
54
+ # setup a test for the new module
55
+ RUN cp -r /usr/share/nginx/html /usr/share/nginx/secure
56
+ COPY ./resources/test-jwt-nginx.conf /etc/nginx/conf.d/test-jwt-nginx.conf
57
+ # download and run nginx binary
58
+ RUN yum -y install nginx-1.12.0 && \
59
+ cp /root/dl/nginx/objs/ngx_http_auth_jwt_module.so /etc/nginx/modules/. && \
60
+ nginx
61
+
62
+ EXPOSE 8000
64
63
0 commit comments