-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathdocker_dev_setup.sh
executable file
·68 lines (54 loc) · 2.25 KB
/
docker_dev_setup.sh
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
#!/usr/bin/env bash
# installs dependencies with Docker Compose and seeds the development database
# reach out to Max Wofford ([email protected]) if you have any questions or issues
echo "
$(tput setaf 9)HCB:$(tput sgr0) Step 1/5: Copy .env file"
cp -n .env.development.example .env.development
echo "$(tput setaf 9)HCB:$(tput sgr0) $(tput setaf 10)Done$(tput sgr0)"
echo "
$(tput setaf 9)HCB:$(tput sgr0) Step 2/5: Build Docker Container"
docker compose build
echo "$(tput setaf 9)HCB:$(tput sgr0) $(tput setaf 10)Done$(tput sgr0)"
echo "
$(tput setaf 9)HCB:$(tput sgr0) Step 3/5: Docker Database Setup"
docker compose run --service-ports web bundle exec rails db:test:prepare RAILS_ENV=test
docker compose run --service-ports web bundle exec rails db:create db:schema:load # We're not using `db:prepare` because we want to run `db:seed` later
echo "$(tput setaf 9)HCB:$(tput sgr0) $(tput setaf 10)Done$(tput sgr0)"
echo "
$(tput setaf 9)HCB:$(tput sgr0) Step 4/5: Create development user"
docker compose up -d >/dev/null 2>&1
echo "Go to localhost:3000 and login to create your development user"
read -p "Press Enter to continue" </dev/tty
docker compose down
echo "$(tput setaf 9)HCB:$(tput sgr0) $(tput setaf 10)Done$(tput sgr0)"
echo "
$(tput setaf 9)HCB:$(tput sgr0) Step 5/5: Development Database Seeding"
docker compose run --service-ports web bundle exec rails db:seed
echo "$(tput setaf 9)HCB:$(tput sgr0) $(tput setaf 10)Done$(tput sgr0)"
if [[ $* == *--with-solargraph* ]]
then
echo "$(tput setaf 9)HCB:$(tput sgr0) Step 6/5: Solargraph"
docker compose -f docker-compose.yml -f docker-compose.solargraph.yml build
echo "$(tput setaf 9)HCB:$(tput sgr0) $(tput setaf 10)Done$(tput sgr0)"
fi
echo "
$(tput setaf 9)HCB:$(tput sgr0)
Run 'docker compose up' to start the dev server. You can run this command with the --with-solargraph flag to enable Solargraph."
echo "
Thank you for developing HCB!
Questions or issues with this script? Contact Max Wofford ([email protected])"
echo "
@HCB@@@@@HCB@
T S
H $ T
E A C A
B H K R
U © H A T
C C K C S
K L U B H
@ HCB HCB HCB E
@ @
HACK FOUNDATION
HCB, A Hack Club Project
© The Hack Foundation
"