-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathvalidate-docker-setup.sh
More file actions
executable file
Β·126 lines (111 loc) Β· 3.79 KB
/
Copy pathvalidate-docker-setup.sh
File metadata and controls
executable file
Β·126 lines (111 loc) Β· 3.79 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
122
123
124
125
126
#!/bin/bash
# Docker Setup Validation Script
# This script validates the Docker configuration files
set -e
echo "π Validating Docker Setup..."
echo ""
# Colors for output
GREEN='\033[0;32m'
RED='\033[0;31m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Check if Docker is installed
echo "1. Checking Docker installation..."
if command -v docker &> /dev/null; then
DOCKER_VERSION=$(docker --version)
echo -e "${GREEN}β${NC} Docker is installed: $DOCKER_VERSION"
else
echo -e "${RED}β${NC} Docker is not installed"
exit 1
fi
# Check if Docker Compose is installed
echo "2. Checking Docker Compose installation..."
if command -v docker-compose &> /dev/null; then
COMPOSE_VERSION=$(docker-compose --version)
echo -e "${GREEN}β${NC} Docker Compose is installed: $COMPOSE_VERSION"
else
echo -e "${RED}β${NC} Docker Compose is not installed"
exit 1
fi
# Validate docker-compose.dev.yml
echo "3. Validating docker-compose.dev.yml..."
if docker-compose -f docker-compose.dev.yml config > /dev/null 2>&1; then
echo -e "${GREEN}β${NC} docker-compose.dev.yml is valid"
else
echo -e "${RED}β${NC} docker-compose.dev.yml has errors"
docker-compose -f docker-compose.dev.yml config
exit 1
fi
# Validate docker-compose.prod.yml
echo "4. Validating docker-compose.prod.yml..."
if docker-compose -f docker-compose.prod.yml config > /dev/null 2>&1; then
echo -e "${GREEN}β${NC} docker-compose.prod.yml is valid"
else
echo -e "${RED}β${NC} docker-compose.prod.yml has errors"
docker-compose -f docker-compose.prod.yml config
exit 1
fi
# Check if Dockerfile exists
echo "5. Checking Dockerfile..."
if [ -f "application/Dockerfile" ]; then
echo -e "${GREEN}β${NC} application/Dockerfile exists"
else
echo -e "${RED}β${NC} application/Dockerfile not found"
exit 1
fi
# Check if .dockerignore exists
echo "6. Checking .dockerignore..."
if [ -f "application/.dockerignore" ]; then
echo -e "${GREEN}β${NC} application/.dockerignore exists"
else
echo -e "${YELLOW}β ${NC} application/.dockerignore not found (optional but recommended)"
fi
# Check if .env.example exists
echo "7. Checking .env.example..."
if [ -f ".env.example" ]; then
echo -e "${GREEN}β${NC} .env.example exists"
else
echo -e "${YELLOW}β ${NC} .env.example not found"
fi
# Check if Makefile exists
echo "8. Checking Makefile..."
if [ -f "Makefile" ]; then
echo -e "${GREEN}β${NC} Makefile exists"
else
echo -e "${YELLOW}β ${NC} Makefile not found (optional but convenient)"
fi
# Check documentation
echo "9. Checking documentation..."
DOCS_FOUND=0
if [ -f "DOCKER_DEPLOYMENT.md" ]; then
echo -e "${GREEN}β${NC} DOCKER_DEPLOYMENT.md exists"
DOCS_FOUND=$((DOCS_FOUND + 1))
fi
if [ -f "DOCKER_QUICK_START.md" ]; then
echo -e "${GREEN}β${NC} DOCKER_QUICK_START.md exists"
DOCS_FOUND=$((DOCS_FOUND + 1))
fi
if [ $DOCS_FOUND -eq 0 ]; then
echo -e "${YELLOW}β ${NC} No Docker documentation found"
fi
# Check if .env exists for production
echo "10. Checking production configuration..."
if [ -f ".env" ]; then
echo -e "${GREEN}β${NC} .env file exists (ready for production)"
else
echo -e "${YELLOW}β ${NC} .env file not found (required for production)"
echo " Run: cp .env.example .env"
fi
echo ""
echo "ββββββββββββββββββββββββββββββββββββββββ"
echo -e "${GREEN}β Validation Complete!${NC}"
echo "ββββββββββββββββββββββββββββββββββββββββ"
echo ""
echo "Next steps:"
echo " Development: make dev-up"
echo " Production: cp .env.example .env && make prod-up"
echo ""
echo "For more information:"
echo " Quick Start: cat DOCKER_QUICK_START.md"
echo " Full Guide: cat DOCKER_DEPLOYMENT.md"
echo ""