mirror of
https://gitea.com/gitea/tea.git
synced 2025-09-02 09:58:29 +02:00
Makefile: add STATIC=true for static PIE builds (#349)
- `make build` + `make install` now support the `STATIC=true` parameter, creating statically linked builds that are also position independent executables - this requires CGO and a static libc on the build system - `CGO_ENABLED=0` is set for all make build targets, unless `STATIC=true` is set - Debug symbols are stripped (`-s -w`) for all make build targets - Release binaries are built statically by gox (no PIE), as before. I also took the liberty to declutter the makefile from unused & duplicated variables. Co-authored-by: Norwin Roosen <git@nroo.de> Co-authored-by: 6543 <6543@obermui.de> Reviewed-on: https://gitea.com/gitea/tea/pulls/349 Reviewed-by: Andrew Thornton <art27@cantab.net> Reviewed-by: 6543 <6543@obermui.de> Co-authored-by: Norwin <noerw@noreply.gitea.io> Co-committed-by: Norwin <noerw@noreply.gitea.io>
This commit is contained in:
@ -2,16 +2,16 @@ ARG GOVERSION="1.16.2"
|
||||
|
||||
FROM golang:${GOVERSION}-alpine AS buildenv
|
||||
|
||||
ARG CGO_ENABLED="0"
|
||||
ARG GOOS="linux"
|
||||
|
||||
COPY . $GOPATH/src/
|
||||
WORKDIR $GOPATH/src
|
||||
|
||||
RUN apk add --quiet --no-cache \
|
||||
build-base \
|
||||
make \
|
||||
git && \
|
||||
make build
|
||||
make clean build STATIC=true
|
||||
|
||||
FROM scratch
|
||||
ARG VERSION="0.7.0"
|
||||
|
Reference in New Issue
Block a user