Compare commits
4 Commits
6ce35caa5f
...
07472b3a54
Author | SHA1 | Date | |
---|---|---|---|
07472b3a54 | |||
adb0484883 | |||
5cfc0a8f7d | |||
0ab86f3063 |
40
Makefile
40
Makefile
|
@ -24,10 +24,17 @@ VERSION ?= $(shell git describe --tags --always --dirty)
|
|||
# This version-strategy uses a manual value to set the version string
|
||||
#VERSION ?= 1.2.3
|
||||
|
||||
# Podman rootless needs 777. Otherwise should be 755
|
||||
BINDIRMODE ?= 777
|
||||
###
|
||||
### These variables should not need tweaking.
|
||||
###
|
||||
|
||||
# So /bin/sh/ sources file at $ENV
|
||||
SHELL := sh
|
||||
.SHELLFLAGS := -ic
|
||||
|
||||
|
||||
SRC_DIRS := cmd pkg # directories which hold app source (not vendored)
|
||||
|
||||
# Windows not working atm
|
||||
|
@ -125,6 +132,8 @@ $(STAMPS): go-build
|
|||
go-build: $(BUILD_DIRS)
|
||||
@echo
|
||||
@echo "building for $(OS)/$(ARCH)"
|
||||
@mkdir -p "$$(pwd)/.go/bin/$(OS)_$(ARCH)"
|
||||
@chmod $(BINDIRMODE) "$$(pwd)/.go/bin/$(OS)_$(ARCH)"
|
||||
@docker run \
|
||||
-i \
|
||||
--rm \
|
||||
|
@ -200,14 +209,16 @@ push: $(CONTAINER_DOTFILES)
|
|||
|
||||
# TODO: Upstream was using manifest-tool and gcloud commands. Needs update
|
||||
manifest-list: # @HELP builds a manifest list of containers for all platforms
|
||||
manifest-list: all-push
|
||||
@for bin in $(BINS); do \
|
||||
platforms=$$(echo $(ALL_PLATFORMS) | sed 's/ /,/g'); \
|
||||
manifest-tool \
|
||||
push from-args \
|
||||
--platforms "$$platforms" \
|
||||
--template $(REGISTRY)/$$bin:$(VERSION)__OS_ARCH \
|
||||
--target $(REGISTRY)/$$bin:$(VERSION); \
|
||||
manifest-list: all-container
|
||||
@for bin in $(BINS); do \
|
||||
docker manifest create $(REGISTRY)/$$bin:$(VERSION); \
|
||||
for platform in $(ALL_PLATFORMS); do \
|
||||
docker manifest add --arch $$(echo $$platform | cut -d/ -f2) \
|
||||
$(REGISTRY)/$$bin:$(VERSION) \
|
||||
$(REGISTRY)/$$bin:$(VERSION)__$$(echo $$platform | sed 's#/#_#g'); \
|
||||
done; \
|
||||
docker manifest push --all $(REGISTRY)/$$bin:$(VERSION) \
|
||||
docker://$(REGISTRY)/$$bin:$(VERSION); \
|
||||
done
|
||||
|
||||
version: # @HELP outputs the version string
|
||||
|
@ -242,7 +253,15 @@ clean: # @HELP removes built binaries and temporary files
|
|||
clean: container-clean bin-clean
|
||||
|
||||
container-clean:
|
||||
rm -rf .container-* .dockerfile-*
|
||||
@rm -rf .container-* .dockerfile-*; \
|
||||
for bin in $(BINS); do \
|
||||
docker image exists "$(REGISTRY)/$$bin:$(VERSION)" && \
|
||||
docker image rm "$(REGISTRY)/$$bin:$(VERSION)"; \
|
||||
for platform in $(ALL_PLATFORMS); do \
|
||||
docker image exists "$(REGISTRY)/$$bin:$(VERSION)__$$(echo $$platform | sed 's#/#_#g')" && \
|
||||
docker image rm "$(REGISTRY)/$$bin:$(VERSION)__$$(echo $$platform | sed 's#/#_#g')"; \
|
||||
done \
|
||||
done; true
|
||||
|
||||
bin-clean:
|
||||
rm -rf .go bin
|
||||
|
@ -261,6 +280,3 @@ help:
|
|||
BEGIN {FS = ": *# *@HELP"}; \
|
||||
{ printf " %-30s %s\n", $$1, $$2 }; \
|
||||
'
|
||||
|
||||
#!/bin/sh
|
||||
# CGO_ENABLED=0 go build -ldflags="-s -w"
|
||||
|
|
Loading…
Reference in New Issue
Block a user