-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile.webserver
34 lines (28 loc) · 1.08 KB
/
Dockerfile.webserver
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
FROM nginx:alpine
# install deps. for `wait-for-it`
RUN apk add --update --no-cache \
bash \
coreutils \
# setup pidfile fully owned by "nginx" user/process
&& mkdir /var/run/nginx \
&& chown nginx:nginx /var/run/nginx \
&& chmod ug+w /var/run/nginx
COPY ./.docker/bin/wait-for-it ./.docker/bin/webserver-foreground.sh /usr/local/bin/
# compile webserver.frontcontroller.conf
ARG FCGI_READ_TIMEOUT=60s
ENV FCGI_HOST=app:9000 \
FCGI_READ_TIMEOUT=$FCGI_READ_TIMEOUT
COPY ./.docker/webserver-frontcontroller.template.nginx /etc/nginx/frontcontroller.template.conf
RUN envsubst '\$FCGI_HOST \$FCGI_READ_TIMEOUT' < /etc/nginx/frontcontroller.template.conf > /etc/nginx/frontcontroller.conf
# compile nginx.conf
ARG WEBSERVER_NGINX_PORT
ENV WEBSERVER_NGINX_PORT=$WEBSERVER_NGINX_PORT
ARG WEBSERVER_NGINX_TEMPLATE=webserver.template.nginx
COPY ./.docker/$WEBSERVER_NGINX_TEMPLATE /etc/nginx/nginx.template.conf
RUN envsubst '\$WEBSERVER_NGINX_PORT' < /etc/nginx/nginx.template.conf > /etc/nginx/nginx.conf
WORKDIR /app
COPY ./www/ ./www/
ARG TAG
ENV TAG=$TAG
USER nginx
CMD ["webserver-foreground.sh"]