-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathDockerfile
45 lines (40 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
FROM debian:stable-slim
# install dependencies
RUN set -ex \
&& apt-get update \
&& apt-get install --no-install-recommends --no-install-suggests -y \
telnet curl net-tools vim \
autoconf automake wget git libtool curl make gcc g++ unzip libpcre3 libpcre3-dev zlib1g zlib1g-dev libssl-dev
COPY source /build/source
COPY third_party /build/third_party
COPY polaris.yaml /build/
# build polaris-cpp
RUN set -ex \
&& cd /build/third_party \
&& git config --global http.sslverify false \
&& git clone -b release_v1.1.0 https://github.com/polarismesh/polaris-cpp polaris-cpp \
&& cd polaris-cpp \
&& make \
&& make package \
&& tar xf polaris_cpp_sdk.tar.gz \
&& mv polaris_cpp_sdk/* /build/third_party/polaris_client/ \
&& cd .. \
&& rm -rf polaris-cpp
RUN set -ex \
&& mkdir -p /etc/nginx \
&& cd /build/third_party \
&& ngx_file_name=nginx-1.23.1 \
&& curl http://nginx.org/download/"$ngx_file_name".tar.gz -o "$ngx_file_name".tar.gz \
&& tar xf "$ngx_file_name".tar.gz \
&& cp nginx/make "$ngx_file_name"/auto/ \
&& cp nginx/nginx.conf "$ngx_file_name"/conf/ \
&& chmod +x "$ngx_file_name"/configure \
&& cd "$ngx_file_name" \
&& ./configure --prefix=/etc/nginx --user=root --add-module=../../source/nginx_polaris_limit_module --add-module=../polaris_client --with-stream --with-cpp=g++ \
&& make \
&& make install \
&& ln -sf /etc/nginx/sbin/nginx /usr/local/bin/nginx \
&& ln -sf /dev/stdout /etc/nginx/logs/access.log \
&& ln -sf /dev/stderr /etc/nginx/logs/error.log \
&& mkdir -p /tmp/polaris
CMD ["nginx", "-g", "daemon off;", "-c", "/etc/nginx/conf/nginx.conf"]