-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
49 lines (36 loc) · 1.52 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
47
48
49
default: help
.PHONY: help build start stop test test-watch clean
help: ## Display this help
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n\nTargets:\n"} /^[a-zA-Z0-9_-]+:.*?##/ { printf " \033[36m%-10s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST)
IMAGE_TAG = cpx-components:dev
build: ## Build the cpx-components test image
podman build -t $(IMAGE_TAG) -f Containerfile.test .
@mkdir -p node_modules
podman create --name node_modules_copy $(IMAGE_TAG)
podman cp node_modules_copy:/usr/src/app/node_modules .
podman rm node_modules_copy
CONTAINER_NAME = cpx-components_dev
start: ## Run the dev service
podman run -d \
-v ./:/usr/src/app \
-v NodeModules:/usr/src/app/node_modules \
-p 8080:8080 \
--name $(CONTAINER_NAME) $(IMAGE_TAG)
podman ps
stop: ## Stop and remove the service container
podman stop $(CONTAINER_NAME)
podman rm $(CONTAINER_NAME)
npm: ## Exec `npm install` in the container and copy out files
podman exec -u 0 $(CONTAINER_NAME) npm install
podman cp $(CONTAINER_NAME):/usr/src/app/node_modules .
podman cp $(CONTAINER_NAME):/usr/src/app/package-lock.json .
build-components: ## Build components
podman exec -u 0 $(CONTAINER_NAME) deno task build
fmt: ## Exec `deno fmt` in the container
podman exec -u 0 $(CONTAINER_NAME) deno fmt
test: ## Exec `deno task test` in the container
podman exec $(CONTAINER_NAME) deno task test
test-watch: ## Exec `deno task test:watch` in the container
podman exec -it $(CONTAINER_NAME) deno task test:watch
clean:
podman rmi $(IMAGE_TAG)