Skip to content

Commit 97086db

Browse files
authored
Merge pull request #39 from paulwilljones/bin-version-for-docker
Add Make install target to facilitate version info in Docker
2 parents 7ed8540 + dfeb9ac commit 97086db

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ RUN go mod download
1212

1313
## Bring in everything else and build an amd64 image
1414
COPY . .
15-
RUN GOOS=linux GOARCH=amd64 go install .
15+
RUN make install
1616

1717
# STAGE 2
1818
# Use a distroless nonroot base image for just our executable

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ VERSION:=$(shell $(ROOT_DIR)/hack/getversion)
44
COMMIT:=$(shell git rev-list -1 HEAD)
55
DATE:=$(shell date -uR)
66
GOVERSION:=$(shell go version | awk '{print $$3 " " $$4}')
7+
GOOS:=$(shell go env GOOS)
8+
GOARCH:=$(shell go env GOARCH)
79

810
DOCKER_IMAGE?=quay.io/jetstack/preflight
911
DOCKER_IMAGE_TAG?=$(DOCKER_IMAGE):$(VERSION)
@@ -17,6 +19,7 @@ define LDFLAGS
1719
endef
1820

1921
GO_BUILD:=go build -ldflags '$(LDFLAGS)'
22+
GO_INSTALL:=go install -ldflags '$(LDFLAGS)'
2023

2124
export GO111MODULE=on
2225

@@ -30,6 +33,9 @@ clean:
3033
build:
3134
cd $(ROOT_DIR) && $(GO_BUILD) -o builds/preflight .
3235

36+
install:
37+
cd $(ROOT_DIR) && $(GO_INSTALL)
38+
3339
test:
3440
cd $(ROOT_DIR) && go test ./...
3541

go.sum

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ github.com/imdario/mergo v0.3.4/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJ
251251
github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
252252
github.com/imdario/mergo v0.3.6 h1:xTNEAn+kxVO7dTZGu0CegyqKZmoWFI0rF8UxjlB2d28=
253253
github.com/imdario/mergo v0.3.6/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
254+
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
254255
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
255256
github.com/influxdata/flux v0.13.0/go.mod h1:81jeDcHVn1rN5uj9aQ81S72Q8ol8If7N0zM0G8TnxTE=
256257
github.com/influxdata/influxdb v1.7.2/go.mod h1:qZna6X/4elxqT3yI9iZYdZrWWdeFOOprn86kgg4+IzY=

0 commit comments

Comments
 (0)