-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathDockerfile
More file actions
36 lines (30 loc) · 1.29 KB
/
Copy pathDockerfile
File metadata and controls
36 lines (30 loc) · 1.29 KB
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
FROM alpine:3.6
MAINTAINER Yifei Kong <kong@yifei.me>
ENV NGINX_VER 1.10.0
# install nginx with google mirror module
RUN apk add --update git openssl-dev pcre-dev zlib-dev wget build-base certbot && \
mkdir src && cd src && \
wget http://nginx.org/download/nginx-${NGINX_VER}.tar.gz && \
tar xzf nginx-${NGINX_VER}.tar.gz && \
git clone https://github.com/cuber/ngx_http_google_filter_module && \
git clone https://github.com/yaoweibin/ngx_http_substitutions_filter_module && \
cd nginx-${NGINX_VER} && \
./configure --prefix=/opt/nginx \
--with-http_ssl_module \
--add-module=../ngx_http_google_filter_module \
--add-module=../ngx_http_substitutions_filter_module && \
make && make install && \
apk del git build-base && \
rm -rf /src && \
rm -rf /var/cache/apk/*
# add config files
COPY ssl.conf /opt/nginx/conf/ssl.conf
COPY letsencrypt.conf /opt/nginx/conf/letsencrypt.conf
COPY nginx_http_only.conf /opt/nginx/conf/nginx_http_only.conf
COPY nginx.conf /opt/nginx/conf/nginx.conf
COPY start.sh /start.sh
# set up renew cron jobs
RUN echo '8 0 * * * certbot renew --noninteractive --renew-hook "/opt/nginx/sbin/nginx -s reload" > /dev/null 2>&1' > /etc/crontabs/root
EXPOSE 80 443
# start nginx and cron in the background
CMD ["/start.sh"]