-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
81 lines (66 loc) · 1.85 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
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
docker-build:
@echo "[DOCKER] Building image"
@docker build -t pkdevel/docker-home .
docker-run:
@echo "[DOCKER] Starting container"
@docker run --rm -d \
-v /var/run/docker.sock:/var/run/docker.sock \
-p 6969:8080 \
--name=docker-home \
pkdevel/docker-home
docker: docker-build
@echo "[DOCKER] Running container"
@docker run --rm -it \
-v /var/run/docker.sock:/var/run/docker.sock \
-p 6969:8080 \
pkdevel/docker-home
generate: _templ _tailwind
@echo "[TEMPL] Generating templates"
@templ generate
@echo "[TAILWIND] Generating styles"
@npx --no -- tailwindcss -c web/tailwind.config.js -i web/template/tailwind.css -o assets/style.css -m
build: generate
@echo "[GO] Building"
@go build -v ./cmd/main.go
run: generate
@echo "[GO] Starting"
@go run ./cmd/main.go
clean:
@echo "[GO] Cleaning"
@go clean
@echo "[DOCKER] Cleaning"
@docker image prune --filter label=name=docker-home --force --all
@docker builder prune --force
@echo "Cleanup build files and database"
@rm -rf data build main
watch:
@make -j4 templ-watch go-watch tailwind-watch tailwind-notify
go-watch: _air
@air --proxy.proxy_port "8181"
templ-watch: _templ
@templ generate --watch \
--proxy="http://localhost:8181" \
--proxyport="6969" \
--open-browser=false
tailwind-watch: _tailwind
@npx --no -- tailwindcss --watch --minify \
-c web/tailwind.config.js \
-i web/template/tailwind.css \
-o assets/style.css
tailwind-notify:
@sleep 1; air -c ".air.notify.toml"
_air:
@if ! command -v air &> /dev/null; then \
echo "[GO] Installing air"; \
go install github.com/air-verse/air@latest; \
fi
_templ:
@if ! command -v templ &> /dev/null; then \
echo "[GO] Installing templ"; \
go install github.com/a-h/templ/cmd/templ@latest; \
fi
_tailwind:
@if ! npm list tailwindcss &> /dev/null ; then \
echo "[NPM] Installing tailwindcss"; \
npm install; \
fi