forked from nullunit/docker-nginx-cache-purge-alpine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
37 lines (29 loc) · 1.04 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
ARG NGINX_VERSION=1.24.0
FROM nginx:$NGINX_VERSION-alpine as build
ARG NGINX_VERSION=1.24.0
RUN apk --update --no-cache add \
gcc \
make \
libc-dev \
g++ \
openssl-dev \
linux-headers \
pcre-dev \
zlib-dev \
libtool \
automake \
autoconf \
git
RUN cd /opt \
&& git clone --depth 1 --single-branch https://github.com/nginx-modules/ngx_cache_purge.git \
&& wget -O - http://nginx.org/download/nginx-$NGINX_VERSION.tar.gz | tar zxfv - \
&& mv /opt/nginx-$NGINX_VERSION /opt/nginx \
&& cd /opt/nginx \
&& ./configure --with-compat --add-dynamic-module=/opt/ngx_cache_purge \
&& make modules
FROM nginx:$NGINX_VERSION-alpine
RUN apk --update --no-cache add \
wget
COPY --from=0 /opt/nginx/objs/ngx_http_cache_purge_module.so /usr/lib/nginx/modules
RUN chmod -R 644 /usr/lib/nginx/modules/ngx_http_cache_purge_module.so \
&& sed -i '1iload_module \/usr\/lib\/nginx\/modules\/ngx_http_cache_purge_module.so;' /etc/nginx/nginx.conf