-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
35 lines (27 loc) · 970 Bytes
/
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
DOCKER_IMAGE_NAME ?= danguita/shell
DOCKER_IMAGE_TAG ?= latest
DOCKER_IMAGE := $(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)
DOCKER_REGISTRY_URL ?= docker.io
USER_HOME := /root
DOCKER_BUILD := docker build --file Dockerfile
DOCKER_PUSH := docker push
DOCKER_TAG := docker tag
DOCKER_RUN := docker run -it --rm --net=host \
-v "$(PWD):/workspace" \
-v "$(HOME)/.ssh:$(USER_HOME)/.ssh" \
-v "$(HOME)/.gnupg:$(USER_HOME)/.gnupg" \
-v "$(HOME)/.gitconfig:$(USER_HOME)/.gitconfig"
CACHEBUST_ARG := CACHEBUST=$(shell date +%s)
.PHONY: build
build: Dockerfile
$(DOCKER_BUILD) --tag $(DOCKER_IMAGE) --build-arg $(CACHEBUST_ARG) .
.PHONY: clean_build
clean_build: Dockerfile
$(DOCKER_BUILD) --no-cache --tag $(DOCKER_IMAGE) --build-arg $(CACHEBUST_ARG) .
.PHONY: run
run:
$(DOCKER_RUN) $(DOCKER_IMAGE)
.PHONY: release
release:
$(DOCKER_TAG) $(DOCKER_IMAGE) $(DOCKER_REGISTRY_URL)/$(DOCKER_IMAGE)
$(DOCKER_PUSH) $(DOCKER_REGISTRY_URL)/$(DOCKER_IMAGE)