-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathentrypoint.sh
More file actions
executable file
·43 lines (38 loc) · 1.31 KB
/
Copy pathentrypoint.sh
File metadata and controls
executable file
·43 lines (38 loc) · 1.31 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
#!/bin/bash
# Temp files created by the container will be erasable by external user
umask 0000
# ensure latest updates
echo -e "\e[33mInstalling dependencies..."
bundle install
npm install
# # just in case to allow edits from the integrated browser editor
# find . \( -type d -exec chmod 777 {} \; \) -o \( -type f -exec chmod 666 {} \; \)
# chmod 777 entrypoint.sh bin/* node_modules/* -R
# chmod +X tmp -R
echo -e "\e[33mTrying to execute migrations..."
if bin/rails db:migrate; then
echo -e "\e[32mDatabase already created. No need for seeding."
else
echo -e "\e[31mMigration failed. Installing database"
bin/rails db:create
if [ -f "db/seeds.sql" ]; then
echo -e "\e[33mSeeding database with db/seeds.sql..."
PGPASSWORD=$DATABASE_PASSWORD psql -U $DATABASE_USERNAME -h $DATABASE_HOST -d decidim_hacks_development -f db/seeds.sql
else
echo -e "\e[32mDatabase just created so let's seed some data..."
bin/rails db:migrate
bin/rails db:seed
echo -e "\e[33mSeeding hacks content..."
bin/rails db:seed:hacks
fi
fi
echo -e "\e[33mRandomizing hero image..."
bin/rails db:seed:randomize
echo
echo -e "\e[32mGreat! Please use this user/password to login:"
echo
echo -e "\e[31madmin@example.org"
echo -e "\e[31mdecidim123456789"
echo
echo "🚀 $@"
exec "$@"