From da2222756316ffa26a857c06aa447e9c37d21640 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Michaud?= Date: Thu, 16 Jan 2020 22:17:03 +0100 Subject: [PATCH] Add trimpath build flag and fix go version to guarantee reproducible build. (#553) --- Dockerfile | 4 ++-- Dockerfile.arm32v7 | 4 ++-- Dockerfile.arm64v8 | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1e0e5c69d..9f336fd5e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # ======================================= # ===== Build image for the backend ===== # ======================================= -FROM golang:1.13-alpine AS builder-backend +FROM golang:1.13.6-alpine AS builder-backend ARG BUILD_TAG ARG BUILD_COMMIT @@ -25,7 +25,7 @@ RUN echo "Write tag ${BUILD_TAG} and commit ${BUILD_COMMIT} in binary." && \ # CGO_ENABLED=1 is mandatory for building go-sqlite3 RUN cd cmd/authelia && \ -GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go build -tags netgo -ldflags '-w -linkmode external -extldflags -static' -o authelia && \ +GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go build -tags netgo -ldflags '-w -linkmode external -extldflags -static' -trimpath -o authelia && \ cd ../authelia-scripts && \ GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go build -ldflags '-w -linkmode external -extldflags -static' -o authelia-scripts diff --git a/Dockerfile.arm32v7 b/Dockerfile.arm32v7 index 7abc6a53d..e3f69f8a4 100644 --- a/Dockerfile.arm32v7 +++ b/Dockerfile.arm32v7 @@ -28,9 +28,9 @@ RUN echo "Write tag ${BUILD_TAG} and commit ${BUILD_COMMIT} in binary." && \ # CGO_ENABLED=1 is mandatory for building go-sqlite3 RUN cd cmd/authelia && \ -GOOS=linux GOARCH=arm CGO_ENABLED=1 CC=arm-linux-musleabihf-gcc go build -tags netgo -ldflags '-w -linkmode external -extldflags -static' -o authelia && \ +GOOS=linux GOARCH=arm CGO_ENABLED=1 CC=arm-linux-musleabihf-gcc go build -tags netgo -ldflags '-w -linkmode external -extldflags -static' -trimpath -o authelia && \ cd ../authelia-scripts && \ -GOOS=linux GOARCH=arm CGO_ENABLED=1 CC=arm-linux-musleabihf-gcc go build -ldflags '-w -linkmode external -extldflags -static' -o authelia-scripts +GOOS=linux GOARCH=arm CGO_ENABLED=1 CC=arm-linux-musleabihf-gcc go build -ldflags '-w -linkmode external -extldflags -static' -trimpath -o authelia-scripts # ======================================== diff --git a/Dockerfile.arm64v8 b/Dockerfile.arm64v8 index 9682b94d7..79138e5f1 100644 --- a/Dockerfile.arm64v8 +++ b/Dockerfile.arm64v8 @@ -28,9 +28,9 @@ RUN echo "Write tag ${BUILD_TAG} and commit ${BUILD_COMMIT} in binary." && \ # CGO_ENABLED=1 is mandatory for building go-sqlite3 RUN cd cmd/authelia && \ -GOOS=linux GOARCH=arm64 CGO_ENABLED=1 CC=aarch64-linux-musl-gcc go build -tags netgo -ldflags '-w -linkmode external -extldflags -static' -o authelia && \ +GOOS=linux GOARCH=arm64 CGO_ENABLED=1 CC=aarch64-linux-musl-gcc go build -tags netgo -ldflags '-w -linkmode external -extldflags -static' -trimpath -o authelia && \ cd ../authelia-scripts && \ -GOOS=linux GOARCH=arm64 CGO_ENABLED=1 CC=aarch64-linux-musl-gcc go build -ldflags '-w -linkmode external -extldflags -static' -o authelia-scripts +GOOS=linux GOARCH=arm64 CGO_ENABLED=1 CC=aarch64-linux-musl-gcc go build -ldflags '-w -linkmode external -extldflags -static' -trimpath -o authelia-scripts # ========================================