-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
122 lines (85 loc) · 3.03 KB
/
Makefile
File metadata and controls
122 lines (85 loc) · 3.03 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# file: Makefile
# author: simshadows <contact@simshadows.com>
ROOT_PATH := $(abspath .)
IMAGE_NAME := simshadows/website-dev
CONTAINER_NAME := website-dev
CONTAINER_HOSTNAME := website-dev
CLAUDE_VOLUME_NAME := website-dev--claude
DEV_SERVER_PORT := 8000
################################################################################
# 0. Meta ######################################################################
################################################################################
# Starts the dev server from scratch
.PHONY: all
all: clean build up yarn-install start
# Build release artifacts from scratch, to be deployed in Prod
.PHONY: all-release
all-release: clean build up yarn-install test release
################################################################################
# 1. Setup #####################################################################
################################################################################
# Build image
.PHONY: build
build:
podman build --pull -t $(IMAGE_NAME) $(ROOT_PATH)
# Start container
.PHONY: up
up:
podman run \
--name $(CONTAINER_NAME) \
-p 127.0.0.1:$(DEV_SERVER_PORT):8000 \
--mount type=bind,src=$(ROOT_PATH),dst=/repo \
--mount type=volume,src=$(CLAUDE_VOLUME_NAME),dst=/home/node/.claude \
--userns keep-id \
--hostname $(CONTAINER_HOSTNAME) \
--rm \
-itd \
$(IMAGE_NAME)
################################################################################
# 2. Actions ###################################################################
################################################################################
# Open shell
.PHONY: shell bash attach enter
shell bash attach enter:
podman exec -it $(CONTAINER_NAME) bash || true
# Run `yarn install`
.PHONY: yarn-install
yarn-install:
podman exec -it $(CONTAINER_NAME) yarn install
# Start dev server
.PHONY: start dev
start dev:
podman exec -it $(CONTAINER_NAME) yarn start --host || true
# Build release artifacts, to be deployed in Prod
.PHONY: release
release:
podman exec -it $(CONTAINER_NAME) yarn build
# Run auto-tests
.PHONY: test
test:
podman exec -it $(CONTAINER_NAME) yarn test
# Run static type checking
.PHONY: typecheck
typecheck:
podman exec -it $(CONTAINER_NAME) yarn typecheck
# Run Claude Code CLI
.PHONY: ai claude
ai claude:
podman exec -it $(CONTAINER_NAME) /home/node/.local/bin/claude
################################################################################
# 3. Teardown ##################################################################
################################################################################
# Stop container
.PHONY: down
down:
podman stop $(CONTAINER_NAME) || true
# Clean up images/containers
# (Does not clean up anything else.)
.PHONY: clean teardown destroy
clean teardown destroy: down
podman rm $(CONTAINER_NAME) || true
podman image rm localhost/$(IMAGE_NAME) || true
# Cleans more up
.PHONY: clean-more teardown-more destroy-more
clean-more teardown-more destroy-more: clean
podman volume rm $(CLAUDE_VOLUME_NAME) || true