Skip to content

Commit f8044a5

Browse files
committed
Fix error with Makefile
Signed-off-by: Zemtsov Vladimir <[email protected]>
1 parent cfba7a0 commit f8044a5

File tree

3 files changed

+18
-8
lines changed

3 files changed

+18
-8
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
### Added
22

3+
4+
### Release v0.0.2
5+
36
- Cleanup: Add automatically tag image before push in Makefile
47
- Cleanup: Fix usage in ReadMe
58
- Cleanup: Fix error with CHANGELOG name file
6-
- CLeanup: Add release to Makefile
9+
- CLeanup: Add release to Makefile
10+
- Cleanup: Fix error with Makefile

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM busybox
22

3-
USER 65534
3+
USER 65533
44

55
ARG BINARY=config-reloader
66
COPY out/$BINARY /config-reloader

Makefile

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ SHELL := /bin/bash -euo pipefail
1616

1717
# Use the native vendor/ dependency system
1818
export GO111MODULE := on
19-
export CGO_ENABLED := 0
2019

20+
GOOS ?= $(shell go env GOOS)
21+
GOARCH ?= $(shell go env GOARCH)
2122

2223
ORG := github.com/vzemtsov
2324
REPOPATH ?= $(ORG)/config-reloader
@@ -27,21 +28,26 @@ BINARY=config-reloader
2728

2829
LDFLAGS := -extldflags '-static'
2930

31+
.PHONY: build-local
32+
build: clean
33+
GOARCH=$(GOARCH) GOOS=$(GOOS) CGO_ENABLED=0 \
34+
go build -ldflags="$(LDFLAGS)" -o out/$(BINARY) cmd/app/main.go
35+
3036
.PHONY: build
3137
build: clean
32-
CGO_ENABLED=0 go build -ldflags="$(LDFLAGS)" -o out/$(BINARY) cmd/app/main.go
38+
GOARCH=amd64 GOOS=linux CGO_ENABLED=0 \
39+
go build -ldflags="$(LDFLAGS)" -o out/$(BINARY) cmd/app/main.go
3340

3441
.PHONY: run
35-
run: build
42+
run: build-local
3643
./out/$(BINARY)
3744

38-
3945
.PHONY: clean
4046
clean:
4147
rm -rf ./out
4248

4349
.PHONY: docker
44-
docker: clean build
50+
docker: build
4551
docker build --build-arg BINARY=$(BINARY) -t $(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG) .
4652

4753
.PHONY: tag
@@ -53,6 +59,6 @@ push: tag
5359
docker push $(DOCKER_IMAGE_NAME):$(TAG)
5460

5561
.PHONY: release
56-
push:
62+
release:
5763
docker tag $(DOCKER_IMAGE_NAME):$(TAG) $(DOCKER_IMAGE_NAME):latest
5864
docker push $(DOCKER_IMAGE_NAME):latest

0 commit comments

Comments
 (0)