docker.mk 665 Bytes
Newer Older
1
2
IMAGEWTAG ?= $(IMAGENAME):$(VERSION)

3
docker-login: ## Log in to the registry. It will only be used in the server, or when running a CI task locally (if CI_BUILD_TOKEN is set).
4
5
6
7
8
9
10
11
12
13
14
ifeq ($(CI_BUILD_TOKEN),)
	@echo "Not logging in to the docker registry" "$(CI_REGISTRY)"
else
	@docker login -u gitlab-ci-token -p $(CI_BUILD_TOKEN) $(CI_REGISTRY)
endif
ifeq ($(HUB_USER),)
	@echo "Not logging in to global the docker registry"
else
	@docker login -u $(HUB_USER) -p $(HUB_PASSWORD)
endif

15
16
17
18
19
login:: docker-login

clean:: docker-clean ## Remove docker credentials

docker-clean:
20
21
22
23
24
ifeq ($(HUB_USER),)
else
	@docker logout
endif

25
.PHONY:: docker-login docker-clean login clean