diff --git a/Dockerfile.gortr b/Dockerfile.gortr index 0b32372..177c9fa 100644 --- a/Dockerfile.gortr +++ b/Dockerfile.gortr @@ -2,6 +2,7 @@ ARG src_dir="/gortr" FROM golang:alpine as builder ARG src_dir +ARG LDFLAGS="" RUN apk --update --no-cache add git && \ mkdir -p ${src_dir} @@ -9,7 +10,7 @@ RUN apk --update --no-cache add git && \ WORKDIR ${src_dir} COPY . . -RUN go build cmd/gortr/gortr.go +RUN go build -ldflags "${LDFLAGS}" cmd/gortr/gortr.go FROM alpine:latest as keygen diff --git a/Makefile b/Makefile index 7a13168..aa88e6f 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,7 @@ GOOS ?= linux ARCH ?= $(shell uname -m) BUILDINFOSDET ?= +DOCKER_REPO := cloudflare/ GORTR_NAME := gortr GORTR_VERSION := $(shell git describe --tags $(git rev-list --tags --max-count=1)) VERSION_PKG := $(shell echo $(GORTR_VERSION) | sed 's/^v//g') @@ -38,7 +39,7 @@ build-gortr: prepare .PHONY: docker-gortr docker-gortr: - docker build -t $(GORTR_NAME):$(GORTR_VERSION) -f Dockerfile.gortr . + docker build -t $(DOCKER_REPO)$(GORTR_NAME):$(GORTR_VERSION) --build-arg LDFLAGS=$(LDFLAGS) -f Dockerfile.gortr . .PHONY: package-deb-gortr package-deb-gortr: prepare