-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
33 lines (24 loc) · 1.03 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
FROM centos:7
# http://nginx.org/packages/mainline/centos/7/x86_64/RPMS/
# nginx-1.13.12-1.el7_4.ngx.x86_64.rpm
ARG NGINX_VERSION=1.13.12-1.el7_4.ngx
ADD nginx.repo /etc/yum.repos.d/nginx.repo
RUN curl -sO http://nginx.org/keys/nginx_signing.key && \
rpm --import ./nginx_signing.key && \
yum install -y nginx-${NGINX_VERSION} && \
yum clean all && \
rm -f ./nginx_signing.key && \
# change permissions
chmod -R 770 /var/cache/nginx/ && \
# listen on 8080 instead of 80
sed -i -e '/listen/!b' -e '/80;/!b' -e 's/80;/8080;/' /etc/nginx/conf.d/default.conf && \
sed -i -e '/user/!b' -e '/nginx/!b' -e '/nginx/d' /etc/nginx/nginx.conf && \
# place pid file under /var/cache/nginx
sed -i 's!/var/run/nginx.pid;!/var/cache/nginx/nginx.pid;!g' /etc/nginx/nginx.conf
# forward request and error logs to docker log collector
RUN ln -sf /dev/stdout /var/log/nginx/access.log
RUN ln -sf /dev/stderr /var/log/nginx/error.log
VOLUME ["/var/cache/nginx"]
EXPOSE 8080
USER nginx:0
CMD ["nginx", "-g", "daemon off;"]