From 446fc3f1f803fd0520167d713451a948ab4cc0fb Mon Sep 17 00:00:00 2001 From: Robin Schneider Date: Tue, 31 Dec 2019 16:20:04 +0100 Subject: [PATCH] Set build time options for dpkg and reproducible builds Ref: https://github.com/moby/moby/issues/4032 Ref: https://sweetcode.io/using-docker-reproducible-build-environments/ Ref: https://github.com/hashbang/aosp-build/blob/master/config/container/Dockerfile --- docker/Dockerfile.j2 | 18 ++++++++++++++---- docker/aarch64/mysql/Dockerfile | 18 ++++++++++++++---- docker/aarch64/sqlite/Dockerfile | 18 ++++++++++++++---- docker/amd64/mysql/Dockerfile | 18 ++++++++++++++---- docker/amd64/mysql/Dockerfile.alpine | 6 ++++++ docker/amd64/postgresql/Dockerfile | 18 ++++++++++++++---- docker/amd64/postgresql/Dockerfile.alpine | 6 ++++++ docker/amd64/sqlite/Dockerfile | 18 ++++++++++++++---- docker/amd64/sqlite/Dockerfile.alpine | 6 ++++++ docker/armv6/mysql/Dockerfile | 18 ++++++++++++++---- docker/armv6/sqlite/Dockerfile | 18 ++++++++++++++---- docker/armv7/mysql/Dockerfile | 18 ++++++++++++++---- docker/armv7/sqlite/Dockerfile | 18 ++++++++++++++---- 13 files changed, 158 insertions(+), 40 deletions(-) diff --git a/docker/Dockerfile.j2 b/docker/Dockerfile.j2 index 41e2f4f7..4a604085 100644 --- a/docker/Dockerfile.j2 +++ b/docker/Dockerfile.j2 @@ -37,10 +37,14 @@ RUN apk add --no-cache --upgrade \ curl \ tar {% else %} -ENV DEBIAN_FRONTEND=noninteractive \ - LANG=C.UTF-8 \ - TZ=UTC \ - TERM=xterm-256color + +# Build time options to avoid dpkg warnings and help with reproducible builds. +ARG DEBIAN_FRONTEND=noninteractive +ARG LANG=C.UTF-8 +ARG TZ=UTC +ARG TERM=xterm-256color + +RUN echo $TERM RUN apt update -y \ && apt install -y \ @@ -80,6 +84,12 @@ ARG DB=mysql ARG DB=postgresql {% endif %} +# Build time options to avoid dpkg warnings and help with reproducible builds. +ARG DEBIAN_FRONTEND=noninteractive +ARG LANG=C.UTF-8 +ARG TZ=UTC +ARG TERM=xterm-256color + # Don't download rust docs RUN rustup set profile minimal diff --git a/docker/aarch64/mysql/Dockerfile b/docker/aarch64/mysql/Dockerfile index 4faea593..5dfac4a5 100644 --- a/docker/aarch64/mysql/Dockerfile +++ b/docker/aarch64/mysql/Dockerfile @@ -8,10 +8,14 @@ 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" -ENV DEBIAN_FRONTEND=noninteractive \ - LANG=C.UTF-8 \ - TZ=UTC \ - TERM=xterm-256color + +# Build time options to avoid dpkg warnings and help with reproducible builds. +ARG DEBIAN_FRONTEND=noninteractive +ARG LANG=C.UTF-8 +ARG TZ=UTC +ARG TERM=xterm-256color + +RUN echo $TERM RUN apt update -y \ && apt install -y \ @@ -34,6 +38,12 @@ FROM rust:1.40 as build # set mysql backend ARG DB=mysql +# Build time options to avoid dpkg warnings and help with reproducible builds. +ARG DEBIAN_FRONTEND=noninteractive +ARG LANG=C.UTF-8 +ARG TZ=UTC +ARG TERM=xterm-256color + # Don't download rust docs RUN rustup set profile minimal diff --git a/docker/aarch64/sqlite/Dockerfile b/docker/aarch64/sqlite/Dockerfile index 5eb00a3f..fa7cd7d6 100644 --- a/docker/aarch64/sqlite/Dockerfile +++ b/docker/aarch64/sqlite/Dockerfile @@ -8,10 +8,14 @@ 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" -ENV DEBIAN_FRONTEND=noninteractive \ - LANG=C.UTF-8 \ - TZ=UTC \ - TERM=xterm-256color + +# Build time options to avoid dpkg warnings and help with reproducible builds. +ARG DEBIAN_FRONTEND=noninteractive +ARG LANG=C.UTF-8 +ARG TZ=UTC +ARG TERM=xterm-256color + +RUN echo $TERM RUN apt update -y \ && apt install -y \ @@ -34,6 +38,12 @@ FROM rust:1.40 as build # set sqlite as default for DB ARG for backward compatibility ARG DB=sqlite +# Build time options to avoid dpkg warnings and help with reproducible builds. +ARG DEBIAN_FRONTEND=noninteractive +ARG LANG=C.UTF-8 +ARG TZ=UTC +ARG TERM=xterm-256color + # Don't download rust docs RUN rustup set profile minimal diff --git a/docker/amd64/mysql/Dockerfile b/docker/amd64/mysql/Dockerfile index 53da03a5..d2d304ff 100644 --- a/docker/amd64/mysql/Dockerfile +++ b/docker/amd64/mysql/Dockerfile @@ -8,10 +8,14 @@ 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" -ENV DEBIAN_FRONTEND=noninteractive \ - LANG=C.UTF-8 \ - TZ=UTC \ - TERM=xterm-256color + +# Build time options to avoid dpkg warnings and help with reproducible builds. +ARG DEBIAN_FRONTEND=noninteractive +ARG LANG=C.UTF-8 +ARG TZ=UTC +ARG TERM=xterm-256color + +RUN echo $TERM RUN apt update -y \ && apt install -y \ @@ -34,6 +38,12 @@ FROM rust:1.40 as build # set mysql backend ARG DB=mysql +# Build time options to avoid dpkg warnings and help with reproducible builds. +ARG DEBIAN_FRONTEND=noninteractive +ARG LANG=C.UTF-8 +ARG TZ=UTC +ARG TERM=xterm-256color + # Don't download rust docs RUN rustup set profile minimal diff --git a/docker/amd64/mysql/Dockerfile.alpine b/docker/amd64/mysql/Dockerfile.alpine index 56151652..b20754b2 100644 --- a/docker/amd64/mysql/Dockerfile.alpine +++ b/docker/amd64/mysql/Dockerfile.alpine @@ -27,6 +27,12 @@ FROM clux/muslrust:nightly-2019-12-19 as build # set mysql backend ARG DB=mysql +# Build time options to avoid dpkg warnings and help with reproducible builds. +ARG DEBIAN_FRONTEND=noninteractive +ARG LANG=C.UTF-8 +ARG TZ=UTC +ARG TERM=xterm-256color + # Don't download rust docs RUN rustup set profile minimal diff --git a/docker/amd64/postgresql/Dockerfile b/docker/amd64/postgresql/Dockerfile index decc2c28..532f6fdf 100644 --- a/docker/amd64/postgresql/Dockerfile +++ b/docker/amd64/postgresql/Dockerfile @@ -8,10 +8,14 @@ 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" -ENV DEBIAN_FRONTEND=noninteractive \ - LANG=C.UTF-8 \ - TZ=UTC \ - TERM=xterm-256color + +# Build time options to avoid dpkg warnings and help with reproducible builds. +ARG DEBIAN_FRONTEND=noninteractive +ARG LANG=C.UTF-8 +ARG TZ=UTC +ARG TERM=xterm-256color + +RUN echo $TERM RUN apt update -y \ && apt install -y \ @@ -34,6 +38,12 @@ FROM rust:1.40 as build # set postgresql backend ARG DB=postgresql +# Build time options to avoid dpkg warnings and help with reproducible builds. +ARG DEBIAN_FRONTEND=noninteractive +ARG LANG=C.UTF-8 +ARG TZ=UTC +ARG TERM=xterm-256color + # Don't download rust docs RUN rustup set profile minimal diff --git a/docker/amd64/postgresql/Dockerfile.alpine b/docker/amd64/postgresql/Dockerfile.alpine index 903a1a30..cef25d1c 100644 --- a/docker/amd64/postgresql/Dockerfile.alpine +++ b/docker/amd64/postgresql/Dockerfile.alpine @@ -27,6 +27,12 @@ FROM clux/muslrust:nightly-2019-12-19 as build # set postgresql backend ARG DB=postgresql +# Build time options to avoid dpkg warnings and help with reproducible builds. +ARG DEBIAN_FRONTEND=noninteractive +ARG LANG=C.UTF-8 +ARG TZ=UTC +ARG TERM=xterm-256color + # Don't download rust docs RUN rustup set profile minimal diff --git a/docker/amd64/sqlite/Dockerfile b/docker/amd64/sqlite/Dockerfile index d874f107..ec5b8496 100644 --- a/docker/amd64/sqlite/Dockerfile +++ b/docker/amd64/sqlite/Dockerfile @@ -8,10 +8,14 @@ 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" -ENV DEBIAN_FRONTEND=noninteractive \ - LANG=C.UTF-8 \ - TZ=UTC \ - TERM=xterm-256color + +# Build time options to avoid dpkg warnings and help with reproducible builds. +ARG DEBIAN_FRONTEND=noninteractive +ARG LANG=C.UTF-8 +ARG TZ=UTC +ARG TERM=xterm-256color + +RUN echo $TERM RUN apt update -y \ && apt install -y \ @@ -34,6 +38,12 @@ FROM rust:1.40 as build # set sqlite as default for DB ARG for backward compatibility ARG DB=sqlite +# Build time options to avoid dpkg warnings and help with reproducible builds. +ARG DEBIAN_FRONTEND=noninteractive +ARG LANG=C.UTF-8 +ARG TZ=UTC +ARG TERM=xterm-256color + # Don't download rust docs RUN rustup set profile minimal diff --git a/docker/amd64/sqlite/Dockerfile.alpine b/docker/amd64/sqlite/Dockerfile.alpine index 221e7e9e..1b08bd21 100644 --- a/docker/amd64/sqlite/Dockerfile.alpine +++ b/docker/amd64/sqlite/Dockerfile.alpine @@ -27,6 +27,12 @@ FROM clux/muslrust:nightly-2019-12-19 as build # set sqlite as default for DB ARG for backward compatibility ARG DB=sqlite +# Build time options to avoid dpkg warnings and help with reproducible builds. +ARG DEBIAN_FRONTEND=noninteractive +ARG LANG=C.UTF-8 +ARG TZ=UTC +ARG TERM=xterm-256color + # Don't download rust docs RUN rustup set profile minimal diff --git a/docker/armv6/mysql/Dockerfile b/docker/armv6/mysql/Dockerfile index 7bf2791a..11426179 100644 --- a/docker/armv6/mysql/Dockerfile +++ b/docker/armv6/mysql/Dockerfile @@ -8,10 +8,14 @@ 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" -ENV DEBIAN_FRONTEND=noninteractive \ - LANG=C.UTF-8 \ - TZ=UTC \ - TERM=xterm-256color + +# Build time options to avoid dpkg warnings and help with reproducible builds. +ARG DEBIAN_FRONTEND=noninteractive +ARG LANG=C.UTF-8 +ARG TZ=UTC +ARG TERM=xterm-256color + +RUN echo $TERM RUN apt update -y \ && apt install -y \ @@ -34,6 +38,12 @@ FROM rust:1.40 as build # set mysql backend ARG DB=mysql +# Build time options to avoid dpkg warnings and help with reproducible builds. +ARG DEBIAN_FRONTEND=noninteractive +ARG LANG=C.UTF-8 +ARG TZ=UTC +ARG TERM=xterm-256color + # Don't download rust docs RUN rustup set profile minimal diff --git a/docker/armv6/sqlite/Dockerfile b/docker/armv6/sqlite/Dockerfile index a9fe22b5..6c713221 100644 --- a/docker/armv6/sqlite/Dockerfile +++ b/docker/armv6/sqlite/Dockerfile @@ -8,10 +8,14 @@ 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" -ENV DEBIAN_FRONTEND=noninteractive \ - LANG=C.UTF-8 \ - TZ=UTC \ - TERM=xterm-256color + +# Build time options to avoid dpkg warnings and help with reproducible builds. +ARG DEBIAN_FRONTEND=noninteractive +ARG LANG=C.UTF-8 +ARG TZ=UTC +ARG TERM=xterm-256color + +RUN echo $TERM RUN apt update -y \ && apt install -y \ @@ -34,6 +38,12 @@ FROM rust:1.40 as build # set sqlite as default for DB ARG for backward compatibility ARG DB=sqlite +# Build time options to avoid dpkg warnings and help with reproducible builds. +ARG DEBIAN_FRONTEND=noninteractive +ARG LANG=C.UTF-8 +ARG TZ=UTC +ARG TERM=xterm-256color + # Don't download rust docs RUN rustup set profile minimal diff --git a/docker/armv7/mysql/Dockerfile b/docker/armv7/mysql/Dockerfile index 7fca4b57..5b8dc6c1 100644 --- a/docker/armv7/mysql/Dockerfile +++ b/docker/armv7/mysql/Dockerfile @@ -8,10 +8,14 @@ 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" -ENV DEBIAN_FRONTEND=noninteractive \ - LANG=C.UTF-8 \ - TZ=UTC \ - TERM=xterm-256color + +# Build time options to avoid dpkg warnings and help with reproducible builds. +ARG DEBIAN_FRONTEND=noninteractive +ARG LANG=C.UTF-8 +ARG TZ=UTC +ARG TERM=xterm-256color + +RUN echo $TERM RUN apt update -y \ && apt install -y \ @@ -34,6 +38,12 @@ FROM rust:1.40 as build # set mysql backend ARG DB=mysql +# Build time options to avoid dpkg warnings and help with reproducible builds. +ARG DEBIAN_FRONTEND=noninteractive +ARG LANG=C.UTF-8 +ARG TZ=UTC +ARG TERM=xterm-256color + # Don't download rust docs RUN rustup set profile minimal diff --git a/docker/armv7/sqlite/Dockerfile b/docker/armv7/sqlite/Dockerfile index 3e25b6e7..15ec9a2b 100644 --- a/docker/armv7/sqlite/Dockerfile +++ b/docker/armv7/sqlite/Dockerfile @@ -8,10 +8,14 @@ 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" -ENV DEBIAN_FRONTEND=noninteractive \ - LANG=C.UTF-8 \ - TZ=UTC \ - TERM=xterm-256color + +# Build time options to avoid dpkg warnings and help with reproducible builds. +ARG DEBIAN_FRONTEND=noninteractive +ARG LANG=C.UTF-8 +ARG TZ=UTC +ARG TERM=xterm-256color + +RUN echo $TERM RUN apt update -y \ && apt install -y \ @@ -34,6 +38,12 @@ FROM rust:1.40 as build # set sqlite as default for DB ARG for backward compatibility ARG DB=sqlite +# Build time options to avoid dpkg warnings and help with reproducible builds. +ARG DEBIAN_FRONTEND=noninteractive +ARG LANG=C.UTF-8 +ARG TZ=UTC +ARG TERM=xterm-256color + # Don't download rust docs RUN rustup set profile minimal