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
FROM alpine:latest as build
ARG UID=1000
ARG GID=1000
ARG NGINX_VER=1.17.6
ARG NGINX_CONF="--prefix=/app --with-cc-opt='-static' \
--with-ld-opt='-static' --with-cpu-opt=generic --with-pcre \
--sbin-path=/app/nginx \
--http-log-path=/app/log/access.log \
--error-log-path=/app/log/error.log \
--pid-path=/app/nginx.pid \
--lock-path=/app/nginx.lock \
--without-http_gzip_module \
--without-http_uwsgi_module \
--without-http_scgi_module \
--without-http_fastcgi_module \
--without-http_memcached_module \
--without-http_empty_gif_module \
--without-http_geo_module \
--with-threads"
WORKDIR /tmp
RUN apk --update upgrade && \
apk add --no-cache --no-progress build-base pcre-dev wget && \
wget http://nginx.org/download/nginx-${NGINX_VER}.tar.gz && \
tar xzf nginx-${NGINX_VER}.tar.gz && \
cd /tmp/nginx-${NGINX_VER} && \
./configure ${NGINX_CONF} && \
make -j 1 && \
make install && \
mkdir /app/tmp && \
chown -R ${UID}:${GID} /app && \
chmod 7777 /app/tmp
FROM scratch
COPY --from=build /app /app
COPY ./docker/nginx.conf /app/nginx.conf
COPY ./client /app/www
EXPOSE 8080
ENTRYPOINT ["/app/nginx"]
CMD ["-c", "/app/nginx.conf"]