Compare commits

...

4 Commits

Author SHA1 Message Date
07472b3a54
update multi-arch manifest push
uses the manifest command from podman, which hopefully is the same as docker.
manifest-tool is the old-and-busted way of doing multi-arch in any case
2020-11-24 15:21:48 -08:00
adb0484883
add podman support (when aliased to docker) 2020-11-24 15:20:14 -08:00
5cfc0a8f7d
remove comments 2020-11-24 15:19:40 -08:00
0ab86f3063
add image removal to container-clean 2020-11-24 15:19:26 -08:00

View File

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