forked from sfc-gh-eraigosa/docker-herokucli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
25 lines (21 loc) · 861 Bytes
/
Makefile
File metadata and controls
25 lines (21 loc) · 861 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
SHELL := /bin/bash
APP_ROOT ?= $(shell pwd)
VERSION ?= $(shell cat "$(APP_ROOT)/VERSION")
TRAVIS_JOB_NUMBER ?= $(VERSION)
TAG ?= $(VERSION).$(TRAVIS_JOB_NUMBER)
DOCKER_USERNAME ?= $(shell git config --get user.email | sed 's/\(.*\)@\(.*\)/\1/')
DOCKER_IMAGE ?= herokucli
.PHONY: build tag push
default: build tag
build:
docker build \
--build-arg DOCKER_IMAGE="$(DOCKER_USERNAME)/$(DOCKER_IMAGE)" \
--build-arg TAG="$(TAG)" \
-t $(DOCKER_IMAGE):$(TAG) .
tag:
docker tag $(DOCKER_IMAGE):$(TAG) $(DOCKER_USERNAME)/$(DOCKER_IMAGE):$(TAG)
docker tag $(DOCKER_USERNAME)/$(DOCKER_IMAGE):$(TAG) $(DOCKER_USERNAME)/$(DOCKER_IMAGE):latest
push:
echo "push $(DOCKER_USERNAME)/$(DOCKER_IMAGE):$(TAG) and latest"
docker push $(DOCKER_USERNAME)/$(DOCKER_IMAGE):$(TAG)
docker push $(DOCKER_USERNAME)/$(DOCKER_IMAGE):latest