latest
All checks were successful
continuous-integration/drone/push Build is passing

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 - push
- pull_request - pull_request
commands: 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 - name: build-and-push
image: plugins/docker image: plugins/docker
environment: environment:

View File

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