Add trimpath build flag and fix go version to guarantee reproducible build. (#553)

This commit is contained in:
Clément Michaud 2020-01-16 22:17:03 +01:00 committed by GitHub
parent 9b8be0fef0
commit da22227563
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 6 deletions

View File

@ -1,7 +1,7 @@
# ======================================= # =======================================
# ===== Build image for the backend ===== # ===== 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_TAG
ARG BUILD_COMMIT 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 # CGO_ENABLED=1 is mandatory for building go-sqlite3
RUN cd cmd/authelia && \ 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 && \ cd ../authelia-scripts && \
GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go build -ldflags '-w -linkmode external -extldflags -static' -o authelia-scripts GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go build -ldflags '-w -linkmode external -extldflags -static' -o authelia-scripts

View File

@ -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 # CGO_ENABLED=1 is mandatory for building go-sqlite3
RUN cd cmd/authelia && \ 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 && \ 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
# ======================================== # ========================================

View File

@ -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 # CGO_ENABLED=1 is mandatory for building go-sqlite3
RUN cd cmd/authelia && \ 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 && \ 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
# ======================================== # ========================================