-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdc
More file actions
executable file
·49 lines (45 loc) · 1.19 KB
/
dc
File metadata and controls
executable file
·49 lines (45 loc) · 1.19 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
#!/bin/sh
set -e
project_name=${COMPOSE_PROJECT_NAME:-mapdump}
extra_args=''
if [ "$1" = 'rebuild' ]; then
shift
"$0" stop $@
"$0" rm -f $@
"$0" build $@
"$0" up -d $@
exit
elif [ "$1" = 'exec' -a $# -eq 2 ]; then
extra_args="$* /bin/bash"
shift 2
elif [ "$1" = 'restoredb' ]; then
if [ $# -eq 2 ]; then
dumpfile=$2
else
dumpfile=postgres.bak
fi
echo "Restoring database from $dumpfile..."
docker exec -i pz01 \
pg_restore -U app_user -d app_db \
--clean --if-exists --no-owner < "$dumpfile"
exit 0
elif [ "$1" = 'pipcompile' ]; then
echo "Compiling pip env..."
docker exec -i -u root md_django \
uv pip compile requirements.in --upgrade --no-header --no-annotate --output-file -o requirements.txt
exit 0
elif [ "$1" = 'pipinstall' ]; then
echo "Updating pip env..."
docker exec -i -u root md_django \
uv pip install -r requirements.txt
exit
elif [ "$1" = 'test' ]; then
shift
extra_args="run --rm django pytest"
fi
export GROUPID=$(id -g) USERID=$(id -u)
exec docker-compose \
--file docker/docker-compose.yml \
--project-name $project_name \
$extra_args \
"$@"