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
#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
manifest-list: all-container
@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); \
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"