-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
47 lines (39 loc) · 936 Bytes
/
Makefile
File metadata and controls
47 lines (39 loc) · 936 Bytes
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
.PHONY: build dev start stop shell clean build-prod
IMAGE_NAME = thothbot-site
CONTAINER_NAME = thothbot-dev
# Build Docker image
build:
docker build -t $(IMAGE_NAME) .
# Start dev server (with hot reload via volume mount)
dev: build
docker run -it --rm \
--name $(CONTAINER_NAME) \
-p 4321:4321 \
-v $(PWD)/src:/app/src \
-v $(PWD)/public:/app/public \
$(IMAGE_NAME)
# Start dev server in background
start: build
docker run -d --rm \
--name $(CONTAINER_NAME) \
-p 4321:4321 \
-v $(PWD)/src:/app/src \
-v $(PWD)/public:/app/public \
$(IMAGE_NAME)
# Stop dev server
stop:
docker stop $(CONTAINER_NAME) || true
# Shell into container
shell: build
docker run -it --rm \
-v $(PWD):/app \
$(IMAGE_NAME) sh
# Test production build
build-prod: build
docker run --rm \
-v $(PWD)/dist:/app/dist \
$(IMAGE_NAME) npm run build
# Clean up
clean:
docker rmi $(IMAGE_NAME) || true
rm -rf dist node_modules