forked from jkrshnmenon/arbiter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
46 lines (34 loc) · 1.47 KB
/
Makefile
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
PWD ?= pwd_unknown
NS ?= ghcr.io/jkrshnmenon/arbiter
IMAGE_NAME ?= $(notdir $(PWD))
TAG ?= latest
CONTAINER_NAME ?= default_instance
.PHONY: help build release shell exec commit run
help:
@echo ''
@echo 'Usage: make [TARGET] [EXTRA_ARGUMENTS]'
@echo 'Targets:'
@echo ' build build docker image $(NS)/$(IMAGE_NAME):$(TAG)'
@echo ' release push docker image $(NS)/$(IMAGE_NAME):$(TAG)'
@echo ' shell debug docker container for image $(NS)/$(IMAGE_NAME):$(TAG) as $(CONTAINER_NAME)'
@echo ' exec run docker container for image $(NS)/$(IMAGE_NAME):$(TAG) as $(CONTAINER_NAME)'
@echo ' commit build and push docker image $(NS)/$(IMAGE_NAME):$(TAG)'
@echo ' run build and run docker image $(NS)/$(IMAGE_NAME):$(TAG) as $(CONTAINER_NAME)'
@echo ''
@echo 'Extra arguments:'
@echo 'TAG=: make TAG="<tag>" (defaults to latest)'
@echo 'IMAGE_NAME=: make IMAGE_NAME="<image_name>" (defaults to directory name)'
@echo 'CONTAINER_NAME=:make CONTAINER_NAME="<container_name>" (defaults to "default_instance")'
build:
# test_scripts/update_image.sh $(TAG)
docker build -t $(NS)/$(IMAGE_NAME):$(TAG) .
release:
docker push $(NS)/$(IMAGE_NAME):$(TAG)
shell: build
docker run --rm --name $(CONTAINER_NAME) -it $(NS)/$(IMAGE_NAME):$(TAG) /bin/bash
debug: build
docker run --rm -v $(PWD):/home/test/ --name $(CONTAINER_NAME) -it $(NS)/$(IMAGE_NAME):$(TAG) /bin/bash
exec:
docker run --rm --name $(CONTAINER_NAME) -it $(NS)/$(IMAGE_NAME):$(TAG)
commit: build release
run: build shell