forked from AlexsLemonade/refinebio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_shell.sh
executable file
·41 lines (34 loc) · 1.35 KB
/
run_shell.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
#!/bin/bash
# Exit on error:
set -e
# Running this script will start an interactive python shell running
# within the context of a Docker container.
# By default the Docker container will be for the foreman project.
# This can be changed by modifying the --env-file command line arg,
# changing foreman/Dockerfile to the appropriate Dockerfile,
# and changing the volume_directory path.
# This script should always run as if it were being called from
# the directory it lives in.
script_directory=`perl -e 'use File::Basename;
use Cwd "abs_path";
print dirname(abs_path(@ARGV[0]));' -- "$0"`
cd $script_directory
# Set up the data volume directory if it does not already exist
volume_directory="$script_directory/foreman/volume"
if [ ! -d "$volume_directory" ]; then
mkdir $volume_directory
chmod -R a+rwX $volume_directory
fi
docker build -t dr_shell -f foreman/dockerfiles/Dockerfile.foreman .
source common.sh
HOST_IP=$(get_ip_address)
DB_HOST_IP=$(get_docker_db_ip_address)
docker run -it \
--add-host=database:$DB_HOST_IP \
--add-host=nomad:$HOST_IP \
--env AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \
--env AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \
--env-file foreman/environments/local \
--volume /tmp:/tmp \
--volume $volume_directory:/home/user/data_store \
--interactive dr_shell python3 manage.py shell