-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcreate_docker_image.sh
More file actions
56 lines (53 loc) · 1.96 KB
/
create_docker_image.sh
File metadata and controls
56 lines (53 loc) · 1.96 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
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
#
#INSTANCE_TYPE="ubuntu"
INSTANCE_TYPE="ami"
#
echo "SCRIPT START TIME"
date
echo " -------------------------------------------------------------------"
echo " ---------- Instance Type ------"
echo " -------------------------------------------------------------------"
echo $INSTANCE_TYPE
echo " -------------------------------------------------------------------"
echo " -------------------------------------------------------------------"
if [ "$INSTANCE_TYPE" == "ami" ]; then
UNAMEX="ec2-user"
HOME="/home/ec2-user"
nproc
NCPUS_VAR=$(nproc)
echo "ncpus = $NCPUS_VAR"
sudo yum update -y
sudo yum install docker -y
sudo yum install git -y
sudo service docker start
sudo usermod -a -G docker $UNAMEX
elif [ "$INSTANCE_TYPE" == "ubuntu" ]; then
UNAMEX="ubuntu"
HOME="/home/ubuntu"
sudo apt-get update
sudo apt-get install docker.io -y
sudo systemctl start docker
sudo systemctl enable docker
else
echo "Instance Type does not exist in config_bash script - please update it."
fi
echo " -------------------------------------------------------------------"
echo " ---------- User Name ------"
echo " -------------------------------------------------------------------"
echo $UNAMEX
echo " -------------------------------------------------------------------"
echo " -------------------------------------------------------------------"
cd /home/$UNAMEX
# clone specific branch
git clone https://github.com/PSUCompBio/aws-config.git
# clone master branch
#git clone https://github.com/PSUCompBio/aws-config.git
cd aws-config/docker_scripts_$INSTANCE_TYPE
docker build \
--build-arg INSTANCE_TYPE=${INSTANCE_TYPE} \
--build-arg UNAMEX=${UNAMEX} \
--build-arg NCPUS_VAR=${NCPUS_VAR} \
-t nsfcareer.${INSTANCE_TYPE} .
cd /home/$UNAMEX
sudo chown -R $UNAMEX *