-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathDockerfile
68 lines (51 loc) · 1.7 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
FROM buildpack-deps:stable as buildpack
LABEL org.opencontainers.image.authors="zhaopku09@gmail.com"
RUN apt-get update \
&& apt-get install -y cmake
WORKDIR /tmp/build
# Build GmSSL lib
COPY GmSSL /tmp/build/GmSSL
RUN cmake ./GmSSL/. \
&& make install \
&& ldconfig
# Build nginx
COPY . /tmp/build/nginx
RUN cd nginx \
&& cp auto/configure . \
&& ./configure \
--sbin-path=/usr/local/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--pid-path=/var/run/nginx/nginx.pid \
--lock-path=/var/lock/nginx/nginx.lock \
--http-log-path=/var/log/nginx/access.log \
--http-client-body-temp-path=/tmp/nginx-client-body \
--with-http_ssl_module \
--without-http_upstream_zone_module \
--with-debug \
&& make -j $(getconf _NPROCESSORS_ONLN) \
&& make install \
&& mkdir /var/lock/nginx \
&& rm -rf /tmp/build
## Export to end-images
FROM debian:stable-slim
ENV TZ=Asia/Shanghai
RUN ln -fs /usr/share/zoneinfo/${TZ} /etc/localtime \
&& echo ${TZ} > /etc/timezone
COPY --from=buildpack /usr/local/lib/libgmssl.* /usr/local/lib/
COPY --from=buildpack /etc/nginx /etc/nginx
COPY --from=buildpack /usr/local/sbin/nginx /usr/local/sbin/nginx
COPY --from=buildpack /usr/local/nginx /usr/local/nginx
# Reload lib cache & make nginx run directories
RUN ldconfig \
&& mkdir -p /var/lock/nginx \
&& mkdir -p /var/log/nginx \
mkdir -p /var/run/nginx
# Forward logs to Docker
RUN ln -sf /dev/stdout /var/log/nginx/access.log \
&& ln -sf /dev/stderr /var/log/nginx/error.log
# Set up config file
COPY conf/nginx_ssl.conf /etc/nginx/conf/nginx.conf
EXPOSE 443/tcp
EXPOSE 80/tcp
CMD ["nginx", "-g", "daemon off;"]