latest
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Jeffrey Paul 2022-12-09 00:50:29 +04:00
parent 69b806fcf5
commit 95aa8bb96a
2 changed files with 19 additions and 15 deletions

View File

@ -10,7 +10,7 @@ steps:
- push
- pull_request
commands:
- echo -n "latest, $(date +'%Y-%m-%d'), ${DRONE_COMMIT_SHA:0:7}, ${DRONE_COMMIT_SHA}, ${DRONE_BRANCH}" > .tags
- echo -n "latest-$(uname -m), $(date +'%Y-%m-%d')-$(uname -m), ${DRONE_COMMIT_SHA:0:7}-$(uname -m), ${DRONE_BRANCH}-$(uname -m)" > .tags
- name: build-and-push
image: plugins/docker
environment:

View File

@ -5,6 +5,7 @@ ARCH := $(shell uname -m)
GITREV := $(shell git describe --always --dirty=-dirty)
D := $(HOME)/Documents/_SYSADMIN/docker/sneak/$(APPNAME)
BRANCH := $(shell git branch --show-current)
YYYYMMDD := $(shell date -u +%Y-%m-%d)
RN := sneak/builder
export DOCKER_IMAGE_CACHE_DIR := $(HOME)/Library/Caches/Docker/$(APPNAME)-$(ARCH)
@ -17,28 +18,31 @@ clean:
build:
docker build \
-t $(RN):$(GITREV) \
-t $(RN):latest \
-t $(RN):$(shell git branch --show-current) \
-t $(RN):$(GITREV)-$(shell uname -m) \
-t $(RN):latest-$(shell uname -m) \
-t $(RN):$(YYYYMMDD)-$(shell uname -m) \
-t $(RN):$(BRANCH)-$(shell uname -m) \
--progress plain --build-arg GITREV=$(GITREV) .
save: $(D)/latest.tzst $(D)/$(BRANCH).tzst
$(D)/$(BRANCH).tzst: $(D)/$(GITREV).tzst
$(D)/$(BRANCH).tzst: $(D)/$(GITREV)-$(shell uname -m).tzst
rm -f $@
ln -s $(D)/$(GITREV).tzst $@
ln -s $(D)/$(GITREV)-$(shell uname -m).tzst $@
$(D)/latest.tzst: $(D)/$(GITREV).tzst
$(D)/latest.tzst: $(D)/$(GITREV)-$(shell uname -m).tzst
rm -f $@
ln -s $(D)/$(GITREV).tzst $@
ln -s $(D)/$(GITREV)-$(shell uname -m).tzst $@
$D/$(GITREV).tzst: build
docker image inspect $(RN):$(GITREV)
$D/$(GITREV)-$(shell uname -m).tzst: build
docker image inspect $(RN):$(GITREV)-$(shell uname -m)
-mkdir -p "$(D)"
docker save $(RN):$(GITREV) | pv | zstdmt -19 > $@.tmp
docker save $(RN):$(GITREV)-$(shell uname -m) | pv | zstdmt -19 > $@.tmp
mv $@.tmp $@
push:
docker push $(RN):$(GITREV)
docker push $(RN):latest
docker push $(RN):$(shell git branch --show-current)
docker push $(RN):$(GITREV)-$(shell uname -m)
docker push $(RN):latest-$(shell uname -m)
docker push $(RN):$(BRANCH)-$(shell uname -m)
docker push $(RN):$(YYYYMMDD)-$(shell uname -m)