forked from itsbcit/docker-openresty
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.erb
91 lines (74 loc) · 3.17 KB
/
Dockerfile.erb
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
FROM bcit/alpine:<%= image.labels['alpine_version'] %>-latest as builder
RUN wget 'http://openresty.org/package/[email protected]' \
-O '/etc/apk/keys/[email protected]' \
&& echo "http://openresty.org/package/alpine/v<%= image.labels['alpine_version'] %>/main" \
>> /etc/apk/repositories
RUN apk add --no-cache \
openresty \
openssl \
make
ADD https://luarocks.github.io/luarocks/releases/luarocks-3.4.0.tar.gz ./luarocks-3.4.0.tar.gz
RUN tar zxf luarocks-3.4.0.tar.gz
WORKDIR /luarocks-3.4.0
RUN ./configure --prefix=/usr/local/openresty/luajit \
--with-lua=/usr/local/openresty/luajit/ \
--lua-suffix=jit \
--with-lua-include=/usr/local/openresty/luajit/include/luajit-2.1 \
&& make \
&& make install
FROM bcit/alpine:<%= image.labels['alpine_version'] %>-latest
<%= snippet('labels', binding) -%>
ENV RUNUSER nginx
ENV HOME /var/cache/nginx
ENV RESTY_SESSION_SECRET "00000000000000000000000000000000"
RUN wget 'http://openresty.org/package/[email protected]' \
-O '/etc/apk/keys/[email protected]' \
&& echo "http://openresty.org/package/alpine/v<%= image.labels['alpine_version'] %>/main" \
>> /etc/apk/repositories
RUN apk add --no-cache \
openresty \
openresty-opm \
openresty-resty \
openssl \
unzip
COPY --from=builder /usr/local/openresty/luajit/bin/luarocks /usr/local/openresty/luajit/bin/luarocks
COPY --from=builder /usr/local/openresty/luajit/bin/luarocks-admin /usr/local/openresty/luajit/bin/luarocks-admin
COPY --from=builder /usr/local/openresty/luajit/etc /usr/local/openresty/luajit/etc
COPY --from=builder /usr/local/openresty/luajit/share/lua/5.1/luarocks /usr/local/openresty/luajit/share/lua/5.1/luarocks
RUN /usr/local/openresty/luajit/bin/luarocks install inspect \
&& rm -rf /var/cache/nginx
RUN mkdir -p \
/application \
/config \
/usr/local/openresty/nginx/conf.d \
/var/cache/nginx \
&& chown -R 0:0 \
/application \
/config \
/usr/local/openresty/nginx/conf \
/usr/local/openresty/nginx/conf.d \
/usr/local/openresty/nginx/logs \
/usr/local/openresty/nginx \
/var/run \
/var/cache/nginx \
&& chmod 775 \
/application \
/config \
/usr/local/openresty/nginx/conf \
/usr/local/openresty/nginx/conf.d \
/usr/local/openresty/nginx/logs \
/usr/local/openresty/nginx \
/var/run \
/var/cache/nginx \
&& ln -sf /usr/local/openresty/nginx/html/index.html /application/index.html \
&& touch /usr/local/openresty/nginx/html/ping \
&& adduser --home /var/cache/nginx --gecos "Nginx Web Server" --system --disabled-password --no-create-home --ingroup root nginx
COPY 50-copy-config.sh /docker-entrypoint.d/
USER nginx
COPY nginx.conf /usr/local/openresty/nginx/conf/nginx.conf
COPY default.conf /usr/local/openresty/nginx/conf.d/default.conf
COPY 00-openresty.conf /usr/local/openresty/nginx/conf.d/00-openresty.conf
COPY resty-env.conf /usr/local/openresty/nginx/conf/resty-env.conf
WORKDIR /application
EXPOSE 8080
CMD ["/usr/local/openresty/nginx/sbin/nginx", "-g", "daemon off;"]