Skip to content

Instantly share code, notes, and snippets.

@barthy1
Created July 24, 2018 18:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save barthy1/af665b77642f4fd901a81a7cfd940c75 to your computer and use it in GitHub Desktop.
Save barthy1/af665b77642f4fd901a81a7cfd940c75 to your computer and use it in GitHub Desktop.
#!/bin/bash
#script to build concourse binary and concoirse image on centos machine
#included resources are docker-image, archiv, time, semver, pool and git
#golang and docker should be installed
#concourse binary will be available at the dir, where script is running
set -e
set -x
function transform {
sudo docker run -dit --name ${2}_cont $1
sudo docker export ${2}_cont | gzip > /tmp/${2}.tar.gz
sudo docker rm -f ${2}_cont
cp /tmp/${2}.tar.gz ${3}/
rm -rf /tmp/${2}.tar.gz
}
#prepeare env
rm -rf concourse_bin1
mkdir -p concourse_bin1
cd concourse_bin1
mkdir -p resources
dir=$PWD
sudo yum install -y git libseccomp libtool-ltdl git libseccomp libtool-ltdl gcc-c++ glibc-static
#export PATH=$PATH:/usr/local/go/bin
#if ! [ -x "$(command -v go)" ]; then
#cd /usr/local
#wget https://redirector.gvt1.com/edgedl/go/go1.9.2.linux-ppc64le.tar.gz -O - | sudo tar -xz
#cd $dir
#fi
#if ! [ -x "$(command -v docker)" ]; then
#cd /tmp
#wget http://ftp.unicamp.br/pub/ppc64el/rhel/7_1/docker-ppc64el/container-selinux-2.9-4.el7.noarch.rpm http://ftp.unicamp.br/pub/ppc64el/rhel/7_1/docker-ppc64el/docker-ce-17.09.0.ce-1.el7.centos.ppc64le.rpm
#sudo rpm -ivh container-selinux-2.9-4.el7.noarch.rpm docker-ce-17.09.0.ce-1.el7.centos.ppc64le.rpm
#sudo systemctl start docker
#rm -rf container-selinux-2.9-4.el7.noarch.rpm docker-ce-17.09.0.ce-1.el7.centos.ppc64le.rpm
#cd $dir
#fi
#get concourse bin
git clone --recursive https://github.com/barthy1/bin -b ppc64le_main
resource_arr=(docker-image archive time semver pool)
#build git resource
resource="git"
cd $dir
git clone --recursive https://github.com/barthy1/${resource}-resource -b ppc64le_main
cd ${resource}-resource
sudo docker build -t ${resource}-resource --no-cache -f Dockerfile_ppc64le .
transform ${resource}-resource ${resource}-resource $dir/resources
#build other resources
for resource in ${resource_arr[*]}
do
cd $dir
git clone --recursive https://github.com/barthy1/${resource}-resource -b ppc64le_main
cd ${resource}-resource
sudo docker build -t ${resource}-resource --no-cache .
transform ${resource}-resource ${resource}-resource $dir/resources
done
#build concourse bin
cd ${dir}/bin
sudo docker build -t concourse_bin --no-cache -f Dockerfile_ppc64le .
./build_concourse_for_power.sh ${dir}/resources
\cp ${dir}/bin/artifacts/concourse_linux_ppc64le ${dir}/../concourse
#build concourse image
cd ${dir}
git clone --recursive https://github.com/concourse/concourse-docker
git clone --recursive https://github.com/Yelp/dumb-init
cd dumb-init
make
cd ../concourse-docker/bin
rm -rf *
cp ../../concourse .
cp ../../dump-init/dump-init .
cd ..
sudo docker build -t concourse --no-cache .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment