-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmake.sh
More file actions
executable file
·77 lines (66 loc) · 1.6 KB
/
make.sh
File metadata and controls
executable file
·77 lines (66 loc) · 1.6 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
#!/usr/bin/env bash
# chatapp.sh - Docker + Django helper script
set -e # Exit immediately if a command fails
DOCKER_DIR="./docker"
DJANGO_CONTAINER="chatapp-django"
# Functions
builddocker() {
echo "Building and starting Docker containers..."
cd "$DOCKER_DIR"
docker compose up -d --build
cd - >/dev/null
}
migrate() {
echo "Running Django migrations..."
docker exec -it "$DJANGO_CONTAINER" poetry run python manage.py migrate
}
makemigrations() {
echo "Creating Django migrations..."
docker exec -it "$DJANGO_CONTAINER" poetry run python manage.py makemigrations
}
seed() {
echo "Seeding..."
docker exec -it "$DJANGO_CONTAINER" poetry run python manage.py seed_database_command local --truncate
}
test() {
docker exec -it "$DJANGO_CONTAINER" poetry run python manage.py test
}
collectstatic() {
docker exec -it "$DJANGO_CONTAINER" poetry run python manage.py collectstatic
}
createsuperuser() {
docker exec -it "$DJANGO_CONTAINER" poetry run python manage.py createsuperuser
}
# Parse command-line argument
if [[ $# -lt 1 ]]; then
echo "Usage: $0 {builddocker|migrate|makemigrations}"
exit 1
fi
case "$1" in
builddocker)
builddocker
;;
migrate)
migrate
;;
makemigrations)
makemigrations
;;
seed)
seed
;;
test)
test
;;
collectstatic)
collectstatic
;;
createsuperuser)
createsuperuser
;;
*)
echo "Unknown command: $1"
echo "Usage: $0 {builddocker|migrate|makemigrations}"
exit 1
;;
esac