Skip to content

Commit 28f08d2

Browse files
committed
Add simple entrypoint
1 parent 08fe10d commit 28f08d2

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

Dockerfile

+6-3
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@ RUN set -x \
1818
RUN set -x \
1919
&& apt-get update \
2020
&& apt-get -y install nginx \
21-
&& apt-clean --aggressive
21+
&& apt-clean --aggressive \
22+
&& sed -i "s/\(worker_processes\) .*;$/\1 1;/" /etc/nginx/nginx.conf
23+
24+
COPY entrypoint /entrypoint
2225

23-
ENTRYPOINT ["/tini", "--"]
24-
CMD ["nginx", "-g", "daemon off;"]
26+
ENTRYPOINT ["/tini", "--", "/entrypoint"]
27+
CMD ["nginx"]
2528
EXPOSE 80 443

entrypoint

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash -e
2+
3+
if [ "${1:0:1}" = "-" ]; then
4+
set -- nginx "$@"
5+
fi
6+
7+
if [ "$1" = "nginx" ]; then
8+
# forward access and error logs to docker log collector
9+
[ -z "$NOSTDOUTREDIR" ] && ln -sf /dev/stdout /var/log/nginx/access.log
10+
[ -z "$NOSTDERRREDIR" ] && ln -sf /dev/stderr /var/log/nginx/error.log
11+
12+
# run nginx in the foreground
13+
exec "$@" -g "daemon off;"
14+
fi
15+
16+
exec "$@"

0 commit comments

Comments
 (0)