forked from curityio/nginx_phantom_token_module
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
218 lines (171 loc) · 7.74 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
######
# FROM ubuntu:18.04 as ubuntu18-builder
# RUN apt-get update && \
# apt-get install -y build-essential libxslt1-dev
# COPY configure /tmp
# COPY config /tmp
# COPY Makefile /tmp
# COPY phantom_token.c /tmp
# ARG NGINX_VERSION
# ENV NGINX_VERSION=$NGINX_VERSION
# ADD nginx-$NGINX_VERSION.tar.gz /tmp/
# WORKDIR /tmp
# RUN ./configure && make
# ######
# FROM ubuntu:20.04 as ubuntu20-builder
# RUN apt-get update && \
# apt-get install -y build-essential wget
# COPY configure /tmp
# COPY config /tmp
# COPY Makefile /tmp
# COPY phantom_token.c /tmp
# ARG NGINX_VERSION
# ENV NGINX_VERSION=$NGINX_VERSION
# ADD nginx-$NGINX_VERSION.tar.gz /tmp/
# WORKDIR /tmp
# RUN wget https://sourceforge.net/projects/pcre/files/pcre/8.45/pcre-8.45.tar.gz && mkdir -p pcre && tar -xz -C pcre -f pcre-8.45.tar.gz --strip-components=1
# RUN wget https://www.zlib.net/zlib-1.3.1.tar.gz && mkdir -p zlib && tar -xz -C zlib -f zlib-1.3.1.tar.gz --strip-components=1
# RUN CONFIG_OPTS="--with-pcre=../pcre --with-zlib=../zlib" ./configure && make
# ######
# FROM ubuntu:22.04 as ubuntu22-builder
# RUN apt-get update && \
# apt-get install -y build-essential wget
# COPY configure /tmp
# COPY config /tmp
# COPY Makefile /tmp
# COPY phantom_token.c /tmp
# ARG NGINX_VERSION
# ENV NGINX_VERSION=$NGINX_VERSION
# ADD nginx-$NGINX_VERSION.tar.gz /tmp/
# WORKDIR /tmp
# RUN wget https://sourceforge.net/projects/pcre/files/pcre/8.45/pcre-8.45.tar.gz && mkdir -p pcre && tar -xz -C pcre -f pcre-8.45.tar.gz --strip-components=1
# RUN wget https://www.zlib.net/zlib-1.3.1.tar.gz && mkdir -p zlib && tar -xz -C zlib -f zlib-1.3.1.tar.gz --strip-components=1
# RUN CONFIG_OPTS="--with-pcre=../pcre --with-zlib=../zlib" ./configure && make
# ######
# # FROM centos:7 as centos7-builder
# # RUN yum install -y \
# # gcc pcre-devel zlib-devel make
# # COPY configure /tmp
# # COPY config /tmp
# # COPY Makefile /tmp
# # COPY phantom_token.c /tmp
# # ARG NGINX_VERSION
# # ENV NGINX_VERSION=$NGINX_VERSION
# # ADD nginx-$NGINX_VERSION.tar.gz /tmp/
# # WORKDIR /tmp
# # RUN ./configure && make
# # ######
# # FROM quay.io/centos/centos:stream9 as centos-stream9-builder
# # RUN yum install -y \
# # gcc pcre-devel zlib-devel make
# # COPY configure /tmp
# # COPY config /tmp
# # COPY Makefile /tmp
# # COPY phantom_token.c /tmp
# # ARG NGINX_VERSION
# # ENV NGINX_VERSION=$NGINX_VERSION
# # ADD nginx-$NGINX_VERSION.tar.gz /tmp/
# # WORKDIR /tmp
# # RUN ./configure && make
# ######
# FROM debian:buster as debian10-builder
# RUN apt update && apt install -y \
# wget build-essential git tree software-properties-common dirmngr apt-transport-https ufw
# COPY configure /tmp
# COPY config /tmp
# COPY Makefile /tmp
# COPY phantom_token.c /tmp
# ARG NGINX_VERSION
# ENV NGINX_VERSION=$NGINX_VERSION
# ADD nginx-$NGINX_VERSION.tar.gz /tmp/
# WORKDIR /tmp
# RUN wget https://sourceforge.net/projects/pcre/files/pcre/8.45/pcre-8.45.tar.gz && mkdir -p pcre && tar -xz -C pcre -f pcre-8.45.tar.gz --strip-components=1
# RUN wget https://www.zlib.net/zlib-1.3.1.tar.gz && mkdir -p zlib && tar -xz -C zlib -f zlib-1.3.1.tar.gz --strip-components=1
# RUN CONFIG_OPTS="--with-pcre=../pcre --with-zlib=../zlib" ./configure && make
# ######
# FROM debian:bullseye as debian11-builder
# RUN apt update && apt install -y \
# wget build-essential git tree software-properties-common dirmngr apt-transport-https ufw
# COPY configure /tmp
# COPY config /tmp
# COPY Makefile /tmp
# COPY phantom_token.c /tmp
# ARG NGINX_VERSION
# ENV NGINX_VERSION=$NGINX_VERSION
# ADD nginx-$NGINX_VERSION.tar.gz /tmp/
# WORKDIR /tmp
# RUN wget https://sourceforge.net/projects/pcre/files/pcre/8.45/pcre-8.45.tar.gz && mkdir -p pcre && tar -xz -C pcre -f pcre-8.45.tar.gz --strip-components=1
# RUN wget https://www.zlib.net/zlib-1.3.1.tar.gz && mkdir -p zlib && tar -xz -C zlib -f zlib-1.3.1.tar.gz --strip-components=1
# RUN CONFIG_OPTS="--with-pcre=../pcre --with-zlib=../zlib" ./configure && make
# ######
# FROM debian:bookworm as debian12-builder
# RUN apt update && apt install -y \
# wget build-essential git tree software-properties-common dirmngr apt-transport-https ufw
# COPY configure /tmp
# COPY config /tmp
# COPY Makefile /tmp
# COPY phantom_token.c /tmp
# ARG NGINX_VERSION
# ENV NGINX_VERSION=$NGINX_VERSION
# ADD nginx-$NGINX_VERSION.tar.gz /tmp/
# WORKDIR /tmp
# RUN wget https://sourceforge.net/projects/pcre/files/pcre/8.45/pcre-8.45.tar.gz && mkdir -p pcre && tar -xz -C pcre -f pcre-8.45.tar.gz --strip-components=1
# RUN wget https://www.zlib.net/zlib-1.3.1.tar.gz && mkdir -p zlib && tar -xz -C zlib -f zlib-1.3.1.tar.gz --strip-components=1
# RUN CONFIG_OPTS="--with-pcre=../pcre --with-zlib=../zlib" ./configure && make
# ######
# FROM amazonlinux:2 as amzn2-builder
# RUN yum install -y \
# gcc pcre-devel zlib-devel make
# COPY configure /tmp
# COPY config /tmp
# COPY Makefile /tmp
# COPY phantom_token.c /tmp
# ARG NGINX_VERSION
# ENV NGINX_VERSION=$NGINX_VERSION
# ADD nginx-$NGINX_VERSION.tar.gz /tmp/
# WORKDIR /tmp
# RUN ./configure && make
# ######
# FROM amazonlinux:2023 as amzn2023-builder
# RUN yum install -y \
# gcc pcre-devel zlib-devel make
# COPY configure /tmp
# COPY config /tmp
# COPY Makefile /tmp
# COPY phantom_token.c /tmp
# ARG NGINX_VERSION
# ENV NGINX_VERSION=$NGINX_VERSION
# ADD nginx-$NGINX_VERSION.tar.gz /tmp/
# WORKDIR /tmp
# RUN ./configure && make
######
FROM alpine as alpine-builder
RUN apk add --no-cache --virtual .build-deps \
gcc libc-dev make openssl-dev pcre-dev zlib-dev linux-headers libxslt-dev \
gd-dev geoip-dev perl-dev libedit-dev mercurial bash alpine-sdk findutils bash
COPY configure /tmp
COPY config /tmp
COPY Makefile /tmp
COPY phantom_token.c /tmp
ARG NGINX_VERSION
ENV NGINX_VERSION=$NGINX_VERSION
ADD nginx-$NGINX_VERSION.tar.gz /tmp/
WORKDIR /tmp
RUN ./configure && make
######
FROM alpine
ARG NGINX_VERSION
ENV NGINX_VERSION=$NGINX_VERSION
# COPY --from=ubuntu18-builder /tmp/nginx-$NGINX_VERSION/objs/ngx_curity_http_phantom_token_module.so /build/ubuntu.18.04.ngx_curity_http_phantom_token_module_$NGINX_VERSION.so
# COPY --from=ubuntu20-builder /tmp/nginx-$NGINX_VERSION/objs/ngx_curity_http_phantom_token_module.so /build/ubuntu.20.04.ngx_curity_http_phantom_token_module_$NGINX_VERSION.so
# COPY --from=ubuntu22-builder /tmp/nginx-$NGINX_VERSION/objs/ngx_curity_http_phantom_token_module.so /build/ubuntu.22.04.ngx_curity_http_phantom_token_module_$NGINX_VERSION.so
# COPY --from=centos7-builder /tmp/nginx-$NGINX_VERSION/objs/ngx_curity_http_phantom_token_module.so /build/centos.7.ngx_curity_http_phantom_token_module_$NGINX_VERSION.so
# COPY --from=centos-stream9-builder /tmp/nginx-$NGINX_VERSION/objs/ngx_curity_http_phantom_token_module.so /build/centos.stream.9.ngx_curity_http_phantom_token_module_$NGINX_VERSION.so
# COPY --from=debian10-builder /tmp/nginx-$NGINX_VERSION/objs/ngx_curity_http_phantom_token_module.so /build/debian.buster.ngx_curity_http_phantom_token_module_$NGINX_VERSION.so
# COPY --from=debian11-builder /tmp/nginx-$NGINX_VERSION/objs/ngx_curity_http_phantom_token_module.so /build/debian.bullseye.ngx_curity_http_phantom_token_module_$NGINX_VERSION.so
# COPY --from=debian12-builder /tmp/nginx-$NGINX_VERSION/objs/ngx_curity_http_phantom_token_module.so /build/debian.bookworm.ngx_curity_http_phantom_token_module_$NGINX_VERSION.so
# COPY --from=amzn2-builder /tmp/nginx-$NGINX_VERSION/objs/ngx_curity_http_phantom_token_module.so /build/amzn2.ngx_curity_http_phantom_token_module_$NGINX_VERSION.so
# COPY --from=amzn2023-builder /tmp/nginx-$NGINX_VERSION/objs/ngx_curity_http_phantom_token_module.so /build/amzn2023.ngx_curity_http_phantom_token_module_$NGINX_VERSION.so
COPY --from=alpine-builder /tmp/nginx-$NGINX_VERSION/objs/ngx_curity_http_phantom_token_module.so /build/alpine.ngx_curity_http_phantom_token_module_$NGINX_VERSION.so
ENTRYPOINT ["sleep"]
CMD ["300"]