From abef566d0a619721144d59f7a8dd482669250276 Mon Sep 17 00:00:00 2001
From: Konstantin Pavlov <thresh@videolan.org>
Date: Tue, 21 Apr 2020 16:19:59 +0300
Subject: [PATCH] Listen on ipv6 by default

Fixes #394.
---
 mainline/alpine-perl/Dockerfile | 5 ++++-
 mainline/alpine/Dockerfile      | 5 ++++-
 mainline/buster-perl/Dockerfile | 4 ++++
 mainline/buster/Dockerfile      | 4 ++++
 stable/alpine-perl/Dockerfile   | 5 ++++-
 stable/alpine/Dockerfile        | 5 ++++-
 stable/buster-perl/Dockerfile   | 4 ++++
 stable/buster/Dockerfile        | 4 ++++
 8 files changed, 32 insertions(+), 4 deletions(-)

diff --git a/mainline/alpine-perl/Dockerfile b/mainline/alpine-perl/Dockerfile
index 7e97484..64ecd48 100644
--- a/mainline/alpine-perl/Dockerfile
+++ b/mainline/alpine-perl/Dockerfile
@@ -102,7 +102,10 @@ RUN set -x \
     && apk add --no-cache tzdata \
 # forward request and error logs to docker log collector
     && ln -sf /dev/stdout /var/log/nginx/access.log \
-    && ln -sf /dev/stderr /var/log/nginx/error.log
+    && ln -sf /dev/stderr /var/log/nginx/error.log \
+# make default server listen on ipv6
+    && sed -i -E 's,listen       80;,listen       80;\n    listen  [::]:80;,' \
+        /etc/nginx/conf.d/default.conf
 
 EXPOSE 80
 
diff --git a/mainline/alpine/Dockerfile b/mainline/alpine/Dockerfile
index 2445257..d7ec4c4 100644
--- a/mainline/alpine/Dockerfile
+++ b/mainline/alpine/Dockerfile
@@ -101,7 +101,10 @@ RUN set -x \
     && apk add --no-cache tzdata \
 # forward request and error logs to docker log collector
     && ln -sf /dev/stdout /var/log/nginx/access.log \
-    && ln -sf /dev/stderr /var/log/nginx/error.log
+    && ln -sf /dev/stderr /var/log/nginx/error.log \
+# make default server listen on ipv6
+    && sed -i -E 's,listen       80;,listen       80;\n    listen  [::]:80;,' \
+        /etc/nginx/conf.d/default.conf
 
 EXPOSE 80
 
diff --git a/mainline/buster-perl/Dockerfile b/mainline/buster-perl/Dockerfile
index 9b4e048..af72698 100644
--- a/mainline/buster-perl/Dockerfile
+++ b/mainline/buster-perl/Dockerfile
@@ -97,6 +97,10 @@ RUN set -x \
 RUN ln -sf /dev/stdout /var/log/nginx/access.log \
     && ln -sf /dev/stderr /var/log/nginx/error.log
 
+# make default server listen on ipv6
+RUN sed -i -E 's,listen       80;,listen       80;\n    listen  [::]:80;,' \
+        /etc/nginx/conf.d/default.conf
+
 EXPOSE 80
 
 STOPSIGNAL SIGTERM
diff --git a/mainline/buster/Dockerfile b/mainline/buster/Dockerfile
index 23e8a81..3394318 100644
--- a/mainline/buster/Dockerfile
+++ b/mainline/buster/Dockerfile
@@ -96,6 +96,10 @@ RUN set -x \
 RUN ln -sf /dev/stdout /var/log/nginx/access.log \
     && ln -sf /dev/stderr /var/log/nginx/error.log
 
+# make default server listen on ipv6
+RUN sed -i -E 's,listen       80;,listen       80;\n    listen  [::]:80;,' \
+        /etc/nginx/conf.d/default.conf
+
 EXPOSE 80
 
 STOPSIGNAL SIGTERM
diff --git a/stable/alpine-perl/Dockerfile b/stable/alpine-perl/Dockerfile
index ed451a0..213f33f 100644
--- a/stable/alpine-perl/Dockerfile
+++ b/stable/alpine-perl/Dockerfile
@@ -102,7 +102,10 @@ RUN set -x \
     && apk add --no-cache tzdata \
 # forward request and error logs to docker log collector
     && ln -sf /dev/stdout /var/log/nginx/access.log \
-    && ln -sf /dev/stderr /var/log/nginx/error.log
+    && ln -sf /dev/stderr /var/log/nginx/error.log \
+# make default server listen on ipv6
+    && sed -i -E 's,listen       80;,listen       80;\n    listen  [::]:80;,' \
+        /etc/nginx/conf.d/default.conf
 
 EXPOSE 80
 
diff --git a/stable/alpine/Dockerfile b/stable/alpine/Dockerfile
index ef1088e..debe3ac 100644
--- a/stable/alpine/Dockerfile
+++ b/stable/alpine/Dockerfile
@@ -101,7 +101,10 @@ RUN set -x \
     && apk add --no-cache tzdata \
 # forward request and error logs to docker log collector
     && ln -sf /dev/stdout /var/log/nginx/access.log \
-    && ln -sf /dev/stderr /var/log/nginx/error.log
+    && ln -sf /dev/stderr /var/log/nginx/error.log \
+# make default server listen on ipv6
+    && sed -i -E 's,listen       80;,listen       80;\n    listen  [::]:80;,' \
+        /etc/nginx/conf.d/default.conf
 
 EXPOSE 80
 
diff --git a/stable/buster-perl/Dockerfile b/stable/buster-perl/Dockerfile
index a477b1c..72c0c92 100644
--- a/stable/buster-perl/Dockerfile
+++ b/stable/buster-perl/Dockerfile
@@ -97,6 +97,10 @@ RUN set -x \
 RUN ln -sf /dev/stdout /var/log/nginx/access.log \
     && ln -sf /dev/stderr /var/log/nginx/error.log
 
+# make default server listen on ipv6
+RUN sed -i -E 's,listen       80;,listen       80;\n    listen  [::]:80;,' \
+        /etc/nginx/conf.d/default.conf
+
 EXPOSE 80
 
 STOPSIGNAL SIGTERM
diff --git a/stable/buster/Dockerfile b/stable/buster/Dockerfile
index 9f289bf..8049d48 100644
--- a/stable/buster/Dockerfile
+++ b/stable/buster/Dockerfile
@@ -96,6 +96,10 @@ RUN set -x \
 RUN ln -sf /dev/stdout /var/log/nginx/access.log \
     && ln -sf /dev/stderr /var/log/nginx/error.log
 
+# make default server listen on ipv6
+RUN sed -i -E 's,listen       80;,listen       80;\n    listen  [::]:80;,' \
+        /etc/nginx/conf.d/default.conf
+
 EXPOSE 80
 
 STOPSIGNAL SIGTERM
-- 
GitLab