-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrun
More file actions
executable file
·92 lines (78 loc) · 2.36 KB
/
run
File metadata and controls
executable file
·92 lines (78 loc) · 2.36 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
#!/usr/bin/env bash
#
# A script to make working with docker/compose to have
# less typing.
#
# For local development only.
COMPOSE="docker compose -f deployment/development/docker-compose.yml --project-directory . -p appbuilder-buildengine-api"
CI_COMPOSE="docker compose -f deployment/ci/docker-compose.yml --project-directory . -p appbuilder-buildengine-api-ci"
function runstuff {
# First arg
given_command=$1
# The rest of the args
arguments=${@:2}
case $given_command in
# docker compose proxy
dc) ${COMPOSE} $arguments;;
up:build) ${COMPOSE} up --build $arguments ;;
up) ${COMPOSE} up $arguments ;;
local)
runstuff dc up -d db valkey
;;
down)
${COMPOSE} down $arguments
;;
build) ${COMPOSE} build $arguments ;;
bash) ${COMPOSE} run --rm $arguments bash;;
restart) ${COMPOSE} stop $arguments && ${COMPOSE} start $arguments;;
db:migrate)
npx prisma migrate dev --schema src/lib/prisma/schema.prisma
;;
db:reset)
npx prisma migrate reset --force --schema src/lib/prisma/schema.prisma
;;
##################
# Testing
ci:build)
${CI_COMPOSE} build
;;
ci)
${CI_COMPOSE} $arguments
;;
################
# Host-Machine Utils
# Don't name any folders bin, obj, tmp, dist, or node_modules
clean:all)
echo "Cleaning..."
shopt -s globstar
rm -rf **/out/ && \
rm -rf **/dist && \
rm -rf **/node_modules && \
rm -rf **/tmp
;;
*) print_help;;
esac
}
function print_help {
echo ""
echo "Available Commands:"
echo ""
echo "dc : short for docker compose"
echo "up:build : starts the docker compose services and builds images"
echo "up : starts the docker compose services"
echo "down : stops the docker compose services"
echo "local : starts external services in docker for local development"
echo ""
echo "bash : drop into a bash shell in a temporary docker compose service"
echo "restart : restart a specific docker compose service"
echo ""
echo "db:migrate : run prisma migrate dev command"
echo "db:reset : run prisma migrate reset command"
echo ""
echo "clean:all : recursively removes out, dist, node_modules, and tmp directories"
}
if [ $1 ]; then
runstuff $*
else
print_help
fi