Update user-data and rearange requirements installation
This commit is contained in:
parent
83cd5046f4
commit
bdaea8040a
@ -33,9 +33,9 @@ WORKDIR /code
|
||||
|
||||
COPY requirements/base.txt .
|
||||
COPY requirements/production.txt .
|
||||
COPY requirements/geeksbot.txt .
|
||||
|
||||
RUN pip install -r production.txt
|
||||
|
||||
COPY requirements/geeksbot.txt .
|
||||
RUN pip install -r geeksbot.txt
|
||||
|
||||
ENV REDIS_DB 0
|
||||
|
||||
15
user-data.sh
15
user-data.sh
@ -1,12 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
yum update -y
|
||||
export AWS_DEFAULT_REGION='us-east-1'
|
||||
instance_id=$(wget -q -O - http://169.254.169.254/latest/meta-data/instance-id)
|
||||
aws ec2 associate-address --instance-id $instance_id --public-ip "34.238.62.161"
|
||||
mkdir /code || exit
|
||||
cd /code || exit
|
||||
git clone git@github.com:dustinpianalto/geeksbot_v2.git
|
||||
cd geeksbot_v2 || exit
|
||||
|
||||
role=$(aws ec2 describe-tags --filters "Name=resource-id,Values=$instance_id" | grep -2 role | grep Value | tr -d ' ' | cut -f2 -d: | tr -d '"' | tr -d ',')
|
||||
if [ "$role" = "development" ]; then
|
||||
aws ec2 associate-address --instance-id "$instance_id" --public-ip "3.211.100.13"
|
||||
git checkout development
|
||||
else
|
||||
aws ec2 associate-address --instance-id "$instance_id" --public-ip "34.238.62.161"
|
||||
git checkout master
|
||||
fi
|
||||
docker build . -t geeksbot || exit
|
||||
docker run -d -v /code/geeksbot_v2:/code -v /root/.ssh:/root/.ssh:ro --name geeksbot --restart always geeksbot:latest || exit
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user