-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathOmni.mk
84 lines (59 loc) · 2.01 KB
/
Omni.mk
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# MKDEV 0.4.0 (x-release-please-version)
# See <https://github.com/ttybitnik/mkdev> for more information.
OMNI_NAME = changeme
CONTAINER_ENGINE = changeme
PODMAN_BIND_SOCKET = false
__USER = $(or $(USER),$(shell whoami))
__AFFIX = omni-$(OMNI_NAME)
__SOCKET = /run/user/$(shell id -u)/podman/podman.sock
# Host targets/commands
.PHONY: dev start stop clean serestore
dev:
$(info Building development container image...)
$(CONTAINER_ENGINE) build \
--build-arg USERNAME=$(__USER) \
-f .mkdev/Containerfile \
-t localhost/mkdev/$(__AFFIX) \
.
start:
$(info Starting development container...)
$(CONTAINER_ENGINE) run -it -d --replace \
$(if $(filter podman,$(CONTAINER_ENGINE)),--userns=keep-id) \
--name mkdev-$(__AFFIX) \
--volume .:/home/$(__USER)/workspace:Z \
--volume mkdev-$(__AFFIX)-cache:/home/$(__USER)/.local \
$(if $(filter true,$(PODMAN_BIND_SOCKET)),--volume $(__SOCKET):$(__SOCKET)) \
$(if $(filter true,$(PODMAN_BIND_SOCKET)),--env CONTAINER_HOST=unix://$(__SOCKET)) \
localhost/mkdev/$(__AFFIX):latest
@# $(CONTAINER_ENGINE) compose .mkdev/compose.yaml up -d
stop:
$(info Stopping development container...)
$(CONTAINER_ENGINE) stop mkdev-$(__AFFIX)
@# $(CONTAINER_ENGINE) compose .mkdev/compose.yaml down
clean: distclean
$(info Removing development container and image...)
-$(CONTAINER_ENGINE) rm mkdev-$(__AFFIX)
-$(CONTAINER_ENGINE) image rm localhost/mkdev/$(__AFFIX)
-$(CONTAINER_ENGINE) volume rm mkdev-$(__AFFIX)-cache
@# $(CONTAINER_ENGINE) image prune
serestore:
$(info Restoring project SELinux context and permissions...)
chcon -Rv unconfined_u:object_r:user_home_t:s0 .
# find . -type d -exec chmod 700 {} \;
# find . -type f -exec chmod 600 {} \;
# Container targets/commands
.PHONY: lint test build run deploy debug distclean
lint:
$(info Running linters...)
test: lint
$(info Running tests...)
build: test
$(info Building...)
run: build
$(info Running...)
deploy: build
$(info Deploying...)
debug: test
$(info Debugging tasks...)
distclean:
$(info Cleaning artifacts...)