From f6a4a2127b64201eac48dbb59e5beb4529d11d04 Mon Sep 17 00:00:00 2001
From: Robin Schneider <ypid@riseup.net>
Date: Tue, 31 Dec 2019 16:24:49 +0100
Subject: [PATCH] Remove duplicate empty lines in generated Dockerfiles

Checked with:

```Shell
find . -type f -print0 | xargs -0 pcregrep -M '\n\n\n'
```
---
 docker/Dockerfile.j2                      | 7 ++++---
 docker/aarch64/mysql/Dockerfile           | 1 -
 docker/aarch64/sqlite/Dockerfile          | 1 -
 docker/amd64/mysql/Dockerfile             | 2 --
 docker/amd64/mysql/Dockerfile.alpine      | 1 -
 docker/amd64/postgresql/Dockerfile        | 2 --
 docker/amd64/postgresql/Dockerfile.alpine | 1 -
 docker/amd64/sqlite/Dockerfile            | 2 --
 docker/amd64/sqlite/Dockerfile.alpine     | 1 -
 docker/armv6/mysql/Dockerfile             | 1 -
 docker/armv6/sqlite/Dockerfile            | 1 -
 docker/armv7/mysql/Dockerfile             | 1 -
 docker/armv7/sqlite/Dockerfile            | 1 -
 13 files changed, 4 insertions(+), 18 deletions(-)

diff --git a/docker/Dockerfile.j2 b/docker/Dockerfile.j2
index 4a604085..54c3e8b8 100644
--- a/docker/Dockerfile.j2
+++ b/docker/Dockerfile.j2
@@ -37,7 +37,6 @@ RUN apk add --no-cache --upgrade \
     curl \
     tar
 {% else %}
-
 # Build time options to avoid dpkg warnings and help with reproducible builds.
 ARG DEBIAN_FRONTEND=noninteractive
 ARG LANG=C.UTF-8
@@ -76,14 +75,16 @@ FROM {{ build_stage_base_image }} as build
 {% if "sqlite" in target_file %}
 # set sqlite as default for DB ARG for backward compatibility
 ARG DB=sqlite
+
 {% elif "mysql" in target_file %}
 # set mysql backend
 ARG DB=mysql
+
 {% elif "postgresql" in target_file %}
 # set postgresql backend
 ARG DB=postgresql
-{% endif %}
 
+{% endif %}
 # Build time options to avoid dpkg warnings and help with reproducible builds.
 ARG DEBIAN_FRONTEND=noninteractive
 ARG LANG=C.UTF-8
@@ -244,8 +245,8 @@ ENV SSL_CERT_DIR=/etc/ssl/certs
 
 {% if "amd64" not in target_file %}
 RUN [ "cross-build-start" ]
-{% endif %}
 
+{% endif %}
 # Install needed libraries
 {% if "alpine" in runtime_stage_base_image %}
 RUN apk add --no-cache \
diff --git a/docker/aarch64/mysql/Dockerfile b/docker/aarch64/mysql/Dockerfile
index 5dfac4a5..c1bf4ad2 100644
--- a/docker/aarch64/mysql/Dockerfile
+++ b/docker/aarch64/mysql/Dockerfile
@@ -8,7 +8,6 @@ ENV VAULT_VERSION "v2.12.0b"
 
 ENV URL "https://github.com/dani-garcia/bw_web_builds/releases/download/$VAULT_VERSION/bw_web_$VAULT_VERSION.tar.gz"
 
-
 # Build time options to avoid dpkg warnings and help with reproducible builds.
 ARG DEBIAN_FRONTEND=noninteractive
 ARG LANG=C.UTF-8
diff --git a/docker/aarch64/sqlite/Dockerfile b/docker/aarch64/sqlite/Dockerfile
index fa7cd7d6..2424c67b 100644
--- a/docker/aarch64/sqlite/Dockerfile
+++ b/docker/aarch64/sqlite/Dockerfile
@@ -8,7 +8,6 @@ ENV VAULT_VERSION "v2.12.0b"
 
 ENV URL "https://github.com/dani-garcia/bw_web_builds/releases/download/$VAULT_VERSION/bw_web_$VAULT_VERSION.tar.gz"
 
-
 # Build time options to avoid dpkg warnings and help with reproducible builds.
 ARG DEBIAN_FRONTEND=noninteractive
 ARG LANG=C.UTF-8
diff --git a/docker/amd64/mysql/Dockerfile b/docker/amd64/mysql/Dockerfile
index d2d304ff..4368a374 100644
--- a/docker/amd64/mysql/Dockerfile
+++ b/docker/amd64/mysql/Dockerfile
@@ -8,7 +8,6 @@ ENV VAULT_VERSION "v2.12.0b"
 
 ENV URL "https://github.com/dani-garcia/bw_web_builds/releases/download/$VAULT_VERSION/bw_web_$VAULT_VERSION.tar.gz"
 
-
 # Build time options to avoid dpkg warnings and help with reproducible builds.
 ARG DEBIAN_FRONTEND=noninteractive
 ARG LANG=C.UTF-8
@@ -88,7 +87,6 @@ ENV ROCKET_ENV "staging"
 ENV ROCKET_PORT=80
 ENV ROCKET_WORKERS=10
 
-
 # Install needed libraries
 RUN apt-get update && apt-get install -y \
     --no-install-recommends \
diff --git a/docker/amd64/mysql/Dockerfile.alpine b/docker/amd64/mysql/Dockerfile.alpine
index b20754b2..b09b422a 100644
--- a/docker/amd64/mysql/Dockerfile.alpine
+++ b/docker/amd64/mysql/Dockerfile.alpine
@@ -82,7 +82,6 @@ ENV ROCKET_PORT=80
 ENV ROCKET_WORKERS=10
 ENV SSL_CERT_DIR=/etc/ssl/certs
 
-
 # Install needed libraries
 RUN apk add --no-cache \
         openssl \
diff --git a/docker/amd64/postgresql/Dockerfile b/docker/amd64/postgresql/Dockerfile
index 532f6fdf..0ba087c7 100644
--- a/docker/amd64/postgresql/Dockerfile
+++ b/docker/amd64/postgresql/Dockerfile
@@ -8,7 +8,6 @@ ENV VAULT_VERSION "v2.12.0b"
 
 ENV URL "https://github.com/dani-garcia/bw_web_builds/releases/download/$VAULT_VERSION/bw_web_$VAULT_VERSION.tar.gz"
 
-
 # Build time options to avoid dpkg warnings and help with reproducible builds.
 ARG DEBIAN_FRONTEND=noninteractive
 ARG LANG=C.UTF-8
@@ -88,7 +87,6 @@ ENV ROCKET_ENV "staging"
 ENV ROCKET_PORT=80
 ENV ROCKET_WORKERS=10
 
-
 # Install needed libraries
 RUN apt-get update && apt-get install -y \
     --no-install-recommends \
diff --git a/docker/amd64/postgresql/Dockerfile.alpine b/docker/amd64/postgresql/Dockerfile.alpine
index cef25d1c..0a298baa 100644
--- a/docker/amd64/postgresql/Dockerfile.alpine
+++ b/docker/amd64/postgresql/Dockerfile.alpine
@@ -82,7 +82,6 @@ ENV ROCKET_PORT=80
 ENV ROCKET_WORKERS=10
 ENV SSL_CERT_DIR=/etc/ssl/certs
 
-
 # Install needed libraries
 RUN apk add --no-cache \
         openssl \
diff --git a/docker/amd64/sqlite/Dockerfile b/docker/amd64/sqlite/Dockerfile
index ec5b8496..f295fad0 100644
--- a/docker/amd64/sqlite/Dockerfile
+++ b/docker/amd64/sqlite/Dockerfile
@@ -8,7 +8,6 @@ ENV VAULT_VERSION "v2.12.0b"
 
 ENV URL "https://github.com/dani-garcia/bw_web_builds/releases/download/$VAULT_VERSION/bw_web_$VAULT_VERSION.tar.gz"
 
-
 # Build time options to avoid dpkg warnings and help with reproducible builds.
 ARG DEBIAN_FRONTEND=noninteractive
 ARG LANG=C.UTF-8
@@ -82,7 +81,6 @@ ENV ROCKET_ENV "staging"
 ENV ROCKET_PORT=80
 ENV ROCKET_WORKERS=10
 
-
 # Install needed libraries
 RUN apt-get update && apt-get install -y \
     --no-install-recommends \
diff --git a/docker/amd64/sqlite/Dockerfile.alpine b/docker/amd64/sqlite/Dockerfile.alpine
index 1b08bd21..269a3dc4 100644
--- a/docker/amd64/sqlite/Dockerfile.alpine
+++ b/docker/amd64/sqlite/Dockerfile.alpine
@@ -76,7 +76,6 @@ ENV ROCKET_PORT=80
 ENV ROCKET_WORKERS=10
 ENV SSL_CERT_DIR=/etc/ssl/certs
 
-
 # Install needed libraries
 RUN apk add --no-cache \
         openssl \
diff --git a/docker/armv6/mysql/Dockerfile b/docker/armv6/mysql/Dockerfile
index 11426179..a89e49b7 100644
--- a/docker/armv6/mysql/Dockerfile
+++ b/docker/armv6/mysql/Dockerfile
@@ -8,7 +8,6 @@ ENV VAULT_VERSION "v2.12.0b"
 
 ENV URL "https://github.com/dani-garcia/bw_web_builds/releases/download/$VAULT_VERSION/bw_web_$VAULT_VERSION.tar.gz"
 
-
 # Build time options to avoid dpkg warnings and help with reproducible builds.
 ARG DEBIAN_FRONTEND=noninteractive
 ARG LANG=C.UTF-8
diff --git a/docker/armv6/sqlite/Dockerfile b/docker/armv6/sqlite/Dockerfile
index 6c713221..3a04b439 100644
--- a/docker/armv6/sqlite/Dockerfile
+++ b/docker/armv6/sqlite/Dockerfile
@@ -8,7 +8,6 @@ ENV VAULT_VERSION "v2.12.0b"
 
 ENV URL "https://github.com/dani-garcia/bw_web_builds/releases/download/$VAULT_VERSION/bw_web_$VAULT_VERSION.tar.gz"
 
-
 # Build time options to avoid dpkg warnings and help with reproducible builds.
 ARG DEBIAN_FRONTEND=noninteractive
 ARG LANG=C.UTF-8
diff --git a/docker/armv7/mysql/Dockerfile b/docker/armv7/mysql/Dockerfile
index 5b8dc6c1..cf9e25c1 100644
--- a/docker/armv7/mysql/Dockerfile
+++ b/docker/armv7/mysql/Dockerfile
@@ -8,7 +8,6 @@ ENV VAULT_VERSION "v2.12.0b"
 
 ENV URL "https://github.com/dani-garcia/bw_web_builds/releases/download/$VAULT_VERSION/bw_web_$VAULT_VERSION.tar.gz"
 
-
 # Build time options to avoid dpkg warnings and help with reproducible builds.
 ARG DEBIAN_FRONTEND=noninteractive
 ARG LANG=C.UTF-8
diff --git a/docker/armv7/sqlite/Dockerfile b/docker/armv7/sqlite/Dockerfile
index 15ec9a2b..33b1bba4 100644
--- a/docker/armv7/sqlite/Dockerfile
+++ b/docker/armv7/sqlite/Dockerfile
@@ -8,7 +8,6 @@ ENV VAULT_VERSION "v2.12.0b"
 
 ENV URL "https://github.com/dani-garcia/bw_web_builds/releases/download/$VAULT_VERSION/bw_web_$VAULT_VERSION.tar.gz"
 
-
 # Build time options to avoid dpkg warnings and help with reproducible builds.
 ARG DEBIAN_FRONTEND=noninteractive
 ARG LANG=C.UTF-8
-- 
GitLab