-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
40 lines (33 loc) · 1001 Bytes
/
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
# Default target
all: clean build
# Stop and remove all running containers
clean:
@echo "Stopping and removing containers..."
docker-compose down
# Remove only dangling Docker images
remove-dangling-images:
@echo "Removing dangling Docker images..."
docker image prune -f
# Prune unused volumes
prune-volumes:
@echo "Pruning unused Docker volumes..."
docker volume prune -f
# Build and start containers without forcing recreation
build:
@echo "Building and starting containers..."
docker-compose up --build
# Prune unused Docker resources
prune:
@echo "Pruning unused Docker resources..."
docker system prune -a -f
# Combined command to clean, prune dangling images, prune volumes, and build
fresh:
@echo "Creating fresh containers and cleaning unused images/volumes..."
$(MAKE) clean
$(MAKE) remove-dangling-images
$(MAKE) prune-volumes
$(MAKE) build
# Full prune for periodic deep cleaning
full-prune:
@echo "Running full Docker prune..."
docker system prune --volumes -a -f