This commit is contained in:
parent
69b806fcf5
commit
95aa8bb96a
@ -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:
|
||||
|
32
Makefile
32
Makefile
@ -5,10 +5,11 @@ 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)
|
||||
|
||||
.PHONY: default save build
|
||||
.PHONY: default save build
|
||||
|
||||
default: save
|
||||
|
||||
@ -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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user