Skip to content
This repository was archived by the owner on Feb 29, 2024. It is now read-only.

Commit ed4fdf5

Browse files
committed
Fix versioning in Dockerfile
1 parent e9408ad commit ed4fdf5

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Dockerfile.gortr

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@ ARG src_dir="/gortr"
22

33
FROM golang:alpine as builder
44
ARG src_dir
5+
ARG LDFLAGS=""
56

67
RUN apk --update --no-cache add git && \
78
mkdir -p ${src_dir}
89

910
WORKDIR ${src_dir}
1011
COPY . .
1112

12-
RUN go build cmd/gortr/gortr.go
13+
RUN go build -ldflags "${LDFLAGS}" cmd/gortr/gortr.go
1314

1415
FROM alpine:latest as keygen
1516

Makefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ GOOS ?= linux
44
ARCH ?= $(shell uname -m)
55
BUILDINFOSDET ?=
66

7+
DOCKER_REPO := cloudflare/
78
GORTR_NAME := gortr
89
GORTR_VERSION := $(shell git describe --tags $(git rev-list --tags --max-count=1))
910
VERSION_PKG := $(shell echo $(GORTR_VERSION) | sed 's/^v//g')
@@ -38,7 +39,7 @@ build-gortr: prepare
3839

3940
.PHONY: docker-gortr
4041
docker-gortr:
41-
docker build -t $(GORTR_NAME):$(GORTR_VERSION) -f Dockerfile.gortr .
42+
docker build -t $(DOCKER_REPO)$(GORTR_NAME):$(GORTR_VERSION) --build-arg LDFLAGS=$(LDFLAGS) -f Dockerfile.gortr .
4243

4344
.PHONY: package-deb-gortr
4445
package-deb-gortr: prepare

0 commit comments

Comments
 (0)