From 8b499e93f0d97056e273a45086dd89c5be0f10a6 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Sat, 18 Apr 2020 13:26:19 +0200 Subject: [PATCH] Ensure readonly-modules when installing tools Signed-off-by: Knut Ahlers --- Dockerfile | 7 +++---- gotools.sh | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 gotools.sh diff --git a/Dockerfile b/Dockerfile index b3b7d7f..c2a7707 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,7 @@ FROM golang:alpine as builder +ENV GO111MODULE=on + COPY . /src WORKDIR /src @@ -9,10 +11,7 @@ RUN set -ex \ curl \ git \ make \ - && go get -v \ - github.com/Luzifer/bind-log-metrics \ - github.com/Luzifer/named-blacklist \ - github.com/Luzifer/rootzone \ + && bash /src/gotools.sh \ && rootzone >named.stubs \ && make blacklist diff --git a/gotools.sh b/gotools.sh new file mode 100644 index 0000000..100975e --- /dev/null +++ b/gotools.sh @@ -0,0 +1,20 @@ +#!/bin/bash +set -euxo pipefail + +packages=( + github.com/Luzifer/bind-log-metrics + github.com/Luzifer/named-blacklist + github.com/Luzifer/rootzone +) + +for pkg in "${packages[@]}"; do + targetdir="/go/src/${pkg}" + + # Get sources + git clone "https://${pkg}.git" "${targetdir}" + + # Go to directory and install util + pushd "${targetdir}" + go install -mod=readonly + popd +done