-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
77 lines (63 loc) · 2.23 KB
/
Makefile
File metadata and controls
77 lines (63 loc) · 2.23 KB
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
DOCKER_IMAGE_NAME = wallet-valuator/dev
DOCKER_IMAGE_VERSION = 2.1.4
DOCKER = sudo docker
DOCKER_CONTEXT = ./docker/
DOCKERFILE = $(DOCKER_CONTEXT)/Dockerfile
WORKSPACE ?= $$(pwd)
.PHONY: docker-image shell open-ide configure clean test build-all compile archive
DOCKER_IMAGE_TAG ?= $(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_VERSION)
docker-image: $(DOCKERFILE)
@echo "$(DOCKER_DOCKER_IMAGE_TAG)"
$(DOCKER) build -f $(DOCKERFILE) -t $(DOCKER_IMAGE_TAG) $(DOCKER_CONTEXT)
# Start a new container and drop into an interactive bash shell
docker-shell: docker-image
$(DOCKER) run -it --rm \
--memory=3g \
--user "$$(id -u):$$(id -g)" \
-e TERM="$$TERM" \
--mount type=bind,src="$(WORKSPACE)",dst=/app \
--mount type=bind,src="$(WORKSPACE)/user",dst=/home \
"$(DOCKER_IMAGE_TAG)" /bin/bash
# Start a new container and run the full test suite
docker-compile: docker-image
$(DOCKER) run -it --rm \
--memory=3g \
--user "$$(id -u):$$(id -g)" \
-e TERM="$$TERM" \
--mount type=bind,src="$(WORKSPACE)",dst=/app \
--mount type=bind,src="$(WORKSPACE)/user",dst=/home \
"$(DOCKER_IMAGE_TAG)" /bin/sh -c "tsc -w"
# Start a new container and run the full test suite
docker-test: docker-image
$(DOCKER) run --rm \
--memory=3g \
--user "$$(id -u):$$(id -g)" \
-e TERM="$$TERM" \
--mount type=bind,src="$(WORKSPACE)",dst=/app \
--mount type=bind,src="$(WORKSPACE)/user",dst=/home \
"$(DOCKER_IMAGE_TAG)" /bin/sh -c "npm test"
# Start a new container and run the linter in fix mode
docker-lint: docker-image
$(DOCKER) run --rm \
--memory=3g \
--user "$$(id -u):$$(id -g)" \
-e TERM="$$TERM" \
--mount type=bind,src="$(WORKSPACE)",dst=/app \
--mount type=bind,src="$(WORKSPACE)/user",dst=/home \
"$(DOCKER_IMAGE_TAG)" /bin/sh -c "npm lint"
DEV_CONTAINER ?=
IDE ?= code
open-ide:
ifndef DEV_CONTAINER
@echo "Error: DEV_CONTAINER not specified"
@echo "Usage: make open-ide [IDE=code] DEV_CONTAINER=my-container-name-or-id
@exit 1
else
$(IDE) --folder-uri "vscode-remote://attached-container+$$(echo -n "$(DEV_CONTAINER)" | xxd -p)/app"
endif
clean:
rm -rf build/
ARCHIVE-PATH ?=
archive: ARCHIVE_NAME = archive-$(shell date +%Y%m%d)-$(shell git rev-parse --short HEAD).tar.gz
archive:
git archive -o $(ARCHIVE_NAME) HEAD -- $(ARCHIVE-PATH)