-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-container-entry.sh
More file actions
executable file
·44 lines (36 loc) · 1.43 KB
/
docker-container-entry.sh
File metadata and controls
executable file
·44 lines (36 loc) · 1.43 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
#!/bin/bash
# https://stackoverflow.com/questions/35022428/rails-server-is-still-running-in-a-new-opened-docker-container#35023225
set -e
## For thin dev server:
if [ -f tmp/pids/server.pid ]; then
rm tmp/pids/server.pid
fi
# built_lock_file="/tmp/generated/yarn.lock"
# current_lock_file="yarn.lock"
# # Restore dirs/files that get removed when mounting volume because the local dev machine
# # doesn't have them.
# # See https://nickjanetakis.com/blog/dealing-with-lock-files-when-using-ruby-node-and-elixir-with-docker
# function cp_node_modules() {
# echo "Restoring node modules (might take a while) ..."
# cp -p "${built_lock_file}" .
# # TODO: Consider using rsync to speed things up
# rm -rf node_modules
# cp -Rp /tmp/generated/node_modules .
# }
if [ "$1" != "bash" ]; then
# Restore dirs/files that get removed when mounting volume if the host machine doesn't have them.
# See https://nickjanetakis.com/blog/dealing-with-lock-files-when-using-ruby-node-and-elixir-with-docker
echo "Restoring auto-generated files ..."
cp -p /tmp/generated/Gemfile.lock .
cp -p /tmp/generated/yarn.lock .
# Not needed as long as it is blacklisted in `docker-compose-dev.yml`
#rsync -ar /tmp/generated/node_modules/ node_modules/
# if [ -f 'yarn.lock' ]; then
# if ! diff "${built_lock_file}" "${current_lock_file}" > /dev/null; then
# cp_node_modules
# fi
# else
# cp_node_modules
# fi
fi
exec bundle exec "$@"