-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
103 lines (85 loc) · 3.43 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
FROM bcit.io/alpine:3.14 as builder
RUN wget 'https://openresty.org/package/[email protected]' \
-O '/etc/apk/keys/[email protected]' \
&& echo "https://openresty.org/package/alpine/v3.14/main" \
>> /etc/apk/repositories
RUN apk add --no-cache \
'luajit=~2.1' \
'openresty=~1.19.9' \
openssl \
make
ADD https://luarocks.github.io/luarocks/releases/luarocks-3.7.0.tar.gz ./luarocks.tar.gz
RUN tar zxf luarocks.tar.gz
WORKDIR /luarocks-3.7.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.io/alpine:3.14
LABEL maintainer="[email protected]"
LABEL build_id="1648149346"
LABEL alpine_version="3.14"
LABEL openresty_version="1.19.9"
LABEL lua_version="5.1"
LABEL luarocks_version="3.7.0"
LABEL luajit_version="2.1"
ENV RUNUSER nginx
ENV HOME /var/cache/nginx
ENV RESTY_SESSION_SECRET "00000000000000000000000000000000"
RUN wget 'https://openresty.org/package/[email protected]' \
-O '/etc/apk/keys/[email protected]' \
&& echo "https://openresty.org/package/alpine/v3.14/main" \
>> /etc/apk/repositories
RUN apk add --no-cache \
'luajit=~2.1' \
'openresty=~1.19.9' \
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 default.conf /usr/local/openresty/nginx/conf.d
COPY nginx.conf /usr/local/openresty/nginx/conf
COPY resty-env.conf /usr/local/openresty/nginx/conf
COPY resty-lua_shared_dict.conf /usr/local/openresty/nginx/conf
COPY nginx-log_format.conf /usr/local/openresty/nginx/conf
COPY resty-session.conf /usr/local/openresty/nginx/conf
WORKDIR /application
EXPOSE 8080
HEALTHCHECK CMD curl -s --fail http://localhost:8080/ping || exit 1
CMD ["/usr/local/openresty/nginx/sbin/nginx", "-g", "daemon off;"]