From 423e06cbe8f57ddd553606b2373d70bc34502928 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Guillot?= Date: Sat, 25 Sep 2021 15:52:32 -0700 Subject: [PATCH] Build RPM and Debian package with PIE mode enabled --- Makefile | 2 +- packaging/rpm/Dockerfile | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index feb94df5..ba9c9344 100644 --- a/Makefile +++ b/Makefile @@ -42,7 +42,7 @@ export PGPASSWORD := postgres debian-packages miniflux: - @ go build -ldflags=$(LD_FLAGS) -o $(APP) main.go + @ go build -buildmode=pie -ldflags=$(LD_FLAGS) -o $(APP) main.go linux-amd64: @ GOOS=linux GOARCH=amd64 go build -ldflags=$(LD_FLAGS) -o $(APP)-linux-amd64 main.go diff --git a/packaging/rpm/Dockerfile b/packaging/rpm/Dockerfile index 01d3f8ee..60f8a60d 100644 --- a/packaging/rpm/Dockerfile +++ b/packaging/rpm/Dockerfile @@ -1,11 +1,7 @@ FROM golang:1 AS build ADD . /go/src/app WORKDIR /go/src/app -RUN go generate -RUN go build \ - -o miniflux \ - -ldflags="-s -w -X 'miniflux.app/version.Version=`git describe --tags --abbrev=0`' -X 'miniflux.app/version.Commit=`git rev-parse --short HEAD`' -X 'miniflux.app/version.BuildDate=`date +%FT%T%z`'" \ - main.go +RUN make miniflux FROM centos:latest RUN dnf install -y rpm-build