Rsr2425 commited on
Commit
89425e7
·
1 Parent(s): 2d3f9e6

Added some container cleanup code

Browse files
Files changed (2) hide show
  1. cleanup.sh +42 -0
  2. test_local.sh +2 -2
cleanup.sh ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ # Colors for output
4
+ BLUE='\033[0;34m'
5
+ GREEN='\033[0;32m'
6
+ YELLOW='\033[1;33m'
7
+ RED='\033[0;31m'
8
+ NC='\033[0m' # No Color
9
+ BOLD='\033[1m'
10
+ DIVIDER="=================================================================="
11
+
12
+ echo -e "\n${BLUE}${DIVIDER}"
13
+ echo -e "${BOLD}🧹 DOCKER CLEANUP"
14
+ echo -e "${BLUE}${DIVIDER}${NC}"
15
+
16
+ # Stop all running containers
17
+ echo -e "\n${YELLOW}Stopping all running containers...${NC}"
18
+ docker stop $(docker ps -q) 2>/dev/null || echo -e "${RED}No running containers found${NC}"
19
+
20
+ # Remove all stopped containers
21
+ echo -e "\n${YELLOW}Removing stopped containers...${NC}"
22
+ docker container prune -f
23
+
24
+ # Remove unused images
25
+ echo -e "\n${YELLOW}Removing unused images...${NC}"
26
+ docker image prune -f
27
+
28
+ # Remove unused networks
29
+ echo -e "\n${YELLOW}Removing unused networks...${NC}"
30
+ docker network prune -f
31
+
32
+ # Remove unused volumes
33
+ echo -e "\n${YELLOW}Removing unused volumes...${NC}"
34
+ docker volume prune -f
35
+
36
+ echo -e "\n${GREEN}✨ Cleanup complete!${NC}"
37
+ echo -e "${YELLOW}Summary of available Docker resources:${NC}"
38
+ echo -e "\n${BOLD}Containers:${NC}"
39
+ docker ps -a
40
+ echo -e "\n${BOLD}Images:${NC}"
41
+ docker images
42
+ echo -e "\n"
test_local.sh CHANGED
@@ -22,7 +22,7 @@ echo -e "${BLUE}${DIVIDER}${NC}"
22
 
23
  # Run frontend tests
24
  echo -e "${YELLOW}Running frontend tests...${NC}"
25
- docker run simplify-test npm test --prefix frontend
26
 
27
  echo -e "\n${BLUE}${DIVIDER}"
28
  echo -e "${BOLD}🐍 BACKEND TESTS"
@@ -30,6 +30,6 @@ echo -e "${BLUE}${DIVIDER}${NC}"
30
 
31
  # Run backend tests
32
  echo -e "${YELLOW}Running backend tests...${NC}"
33
- docker run --env-file .env simplify-test pytest backend/tests
34
 
35
  echo -e "\n${GREEN}✨ Testing complete!${NC}\n"
 
22
 
23
  # Run frontend tests
24
  echo -e "${YELLOW}Running frontend tests...${NC}"
25
+ docker run --rm simplify-test npm test --prefix frontend
26
 
27
  echo -e "\n${BLUE}${DIVIDER}"
28
  echo -e "${BOLD}🐍 BACKEND TESTS"
 
30
 
31
  # Run backend tests
32
  echo -e "${YELLOW}Running backend tests...${NC}"
33
+ docker run --rm --env-file .env simplify-test pytest backend/tests
34
 
35
  echo -e "\n${GREEN}✨ Testing complete!${NC}\n"