-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
37 lines (31 loc) · 1.12 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
NAME := migi
REPO := github.com/rjansen
VERSION := $(notdir $(shell git describe --tags --always))
BUILD := $(VERSION).$(shell git rev-parse --short HEAD)
MAKEFILE := $(lastword $(MAKEFILE_LIST))
BASE_DIR := $(shell cd $(dir $(MAKEFILE)); pwd)
TMP_DIR ?= $(BASE_DIR)/tmp
DOCKER_NAME := e-pedion/$(NAME)
DOCKER_FILE := ./Dockerfile
.PHONY: clearcache
clearcache:
@echo "$(NAME)@$(BUILD) clearcache"
-rm -Rf $(TMP_DIR)
$(TMP_DIR):
mkdir -p $(TMP_DIR)
.PHONY: docker
docker.build:
@echo "$(NAME)@$(BUILD) docker"
docker build --build-arg UID=$(shell id -u) --build-arg GID=$(shell id -g) \
-t $(DOCKER_NAME) -t $(DOCKER_NAME):$(VERSION) -f $(DOCKER_FILE) .
.PHONY: docker.bash
docker.bash:
@echo "$(NAME)@$(BUILD) docker.bash"
docker run --rm --name $(NAME)-bash --entrypoint bash -it -u $(shell id -u):$(shell id -g) \
-v $(BASE_DIR):/app/$(NAME) $(DOCKER_NAME)
docker.%:
@echo "$(NAME)@$(BUILD) docker.$*"
docker run --rm --name $(NAME)-run -u $(shell id -u):$(shell id -g) \
-v $(BASE_DIR):/app/$(NAME) $(DOCKER_NAME) $*
# dependencies
include scripts/make/Makefile