forked from boozallen/devsecops-example-helloworld
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap-jenkins.sh
38 lines (28 loc) · 1.07 KB
/
bootstrap-jenkins.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
#!/usr/bin/env bash
set -e
set -x
JENKINS_DATA_HOME="/var/jenkins_home"
JENKINS_USER="ec2-user"
JENKINS_IMAGE="jenkins"
# https://store.docker.com/editions/community/docker-ce-server-centos?tab=description
echo "================ Installing docker ================"
yum install -y yum-utils > /dev/null
yum-config-manager --enable rhui-REGION-rhel-server-extras
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum makecache fast
yum install -y docker-ce
yum update -y
echo "================ Setup docker service ================"
chkconfig docker on
service docker start
echo "================ Run test container ================"
docker run hello-world
echo "================ Setup jenkins user ================"
mkdir -p "${JENKINS_DATA_HOME}"
chown -R "${JENKINS_USER}:${JENKINS_USER}" "${JENKINS_DATA_HOME}"
usermod -a -G docker "${JENKINS_USER}"
echo "================ Get jenkins container ================"
docker pull "${JENKINS_IMAGE}"
echo "================ Setup jenkins service ================"
chkconfig jenkins on
service jenkins start