forked from wri/sentinel-tree-cover
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker_setup.sh
59 lines (45 loc) · 2.66 KB
/
docker_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
# Step to build and push new edits to docker image
docker build -t tof_download . &&\
aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 838255262149.dkr.ecr.us-east-1.amazonaws.com &&\
docker tag tof_download:latest 838255262149.dkr.ecr.us-east-1.amazonaws.com/tof_download:latest &&\
docker push 838255262149.dkr.ecr.us-east-1.amazonaws.com/tof_download:latest
docker build -t tof_analysis . &&\
docker tag tof_analysis:latest 838255262149.dkr.ecr.us-east-1.amazonaws.com/tof_analysis:latest &&\
docker push 838255262149.dkr.ecr.us-east-1.amazonaws.com/tof_analysis:latest
# Steps to reate new node on EC2
sudo yum update -y &&\
sudo yum install docker -y &&\
sudo service docker start &&\
sudo usermod -a -G docker ec2-user &&\
sudo chmod 666 /var/run/docker.sock &&\
sudo yum install tmux -y
aws configure
aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 838255262149.dkr.ecr.us-east-1.amazonaws.com &&\
docker pull 838255262149.dkr.ecr.us-east-1.amazonaws.com/tof_download:latest &&\
tmux new -s node-node-4
docker run -it --entrypoint /bin/bash 838255262149.dkr.ecr.us-east-1.amazonaws.com/tof_download
cd src
python3 download_and_predict_job.py --country "Zambia" --ul_flag True
# Steps to update a node with a new image
sudo service docker start &&\
aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 838255262149.dkr.ecr.us-east-1.amazonaws.com &&\
docker stop $(docker ps -a -q) &&\
docker pull 838255262149.dkr.ecr.us-east-1.amazonaws.com/tof_download:latest &&\
docker system prune -f &&\
tmux attach
# Steps to start a new container and load into the image
sudo service docker start &&\
aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 838255262149.dkr.ecr.us-east-1.amazonaws.com &&\
docker pull 838255262149.dkr.ecr.us-east-1.amazonaws.com/tof_download:latest &&\
docker system prune -f &&\
tmux new -s node-node-2
python3.7 download_and_predict_job_fast.py --country "Papua New Guinea" --db_path "asia_tropics.csv" --ul_flag True
docker run -it --entrypoint /bin/bash 838255262149.dkr.ecr.us-east-1.amazonaws.com/tof_download
cd src
python3 download_and_predict_job.py --country "Mali" --ul_flag True
# analysis
sudo service docker start &&\
aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 838255262149.dkr.ecr.us-east-1.amazonaws.com &&\
docker stop $(docker ps -a -q) &&\
docker pull 838255262149.dkr.ecr.us-east-1.amazonaws.com/tof_analysis:latest &&docker system prune -f &&tmux attach
docker run -p 8888:8888 838255262149.dkr.ecr.us-east-1.amazonaws.com/tof_analysis