-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
27 lines (23 loc) · 693 Bytes
/
Makefile
File metadata and controls
27 lines (23 loc) · 693 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
.PHONY: go docker clean deepClean
# Run the application locally
go:
go run main.go
# Build and run the Docker container
# [WARNING] don't set PORT in .env
docker:
PORT=$$(go run main.go -print-port) && \
docker build --build-arg PORT=$$PORT -t forum . && \
docker run -e PORT=$$PORT -p $$PORT:$$PORT --name forum \
-v $(PWD)/database:/app/database \
--rm forum
# Stop and clean up Docker resources
clean:
-docker stop forum || true
-docker rmi forum || true
-docker system prune -f --volumes
# Stop and clean up All Docker resources
deepClean:
-docker stop $$(docker ps -aq)
-docker rm $$(docker ps -aq)
-docker rmi $$(docker images -q)
-docker system prune -a -f --volumes