Skip to content

Commit eb9a673

Browse files
committed
added Makefile targets for container building
1 parent 4e7ec53 commit eb9a673

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

Makefile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
TAG = $(shell git describe --tags --always)
2+
PREFIX = $(shell git config --get remote.origin.url | tr ':.' '/' | rev | cut -d '/' -f 3 | rev)
3+
REPO_NAME = $(shell git config --get remote.origin.url | tr ':.' '/' | rev | cut -d '/' -f 2 | rev)
4+
5+
all: push
6+
7+
container: image
8+
9+
image:
10+
docker build -t $(PREFIX)/$(REPO_NAME) . # Build new image and automatically tag it as latest
11+
docker tag $(PREFIX)/$(REPO_NAME) $(PREFIX)/$(REPO_NAME):$(TAG) # Add the version tag to the latest image
12+
13+
push: image
14+
docker push $(PREFIX)/$(REPO_NAME) # Push image tagged as latest to repository
15+
docker push $(PREFIX)/$(REPO_NAME):$(TAG) # Push version tagged image to repository (since this image is already pushed it will simply create or update version tag)
16+
17+
clean:

0 commit comments

Comments
 (0)