MLops for beginners

Day19: Getting started with S2I (Source to Image)

What is S2I? Why you need it? How can you use it to leverage the power of complete devops life-cycle?

|-- sampleapp/
|-- sampleapp/
|-- .s2i # new folder
|-- environment # new file


sudo dnf config-manager --add-repo= dnf install docker-ce-3:18.09.1-3.el7 -ysudo systemctl start docker
sudo yum install unzip git wget -ywget xvf source-to-image-v1.3.0-eed2850f-linux-amd64.tar.gz
sudo cp s2i /usr/local/bin/    or (You can do both if you are not sure)sudo cp s2i /usr/bin
# This will download the source code from github and use 
# "centos/python-36-centos7" as the base image and will finally
# give you a "voiceaim-website" docker image.
sudo s2i build centos/python-36-centos7 voiceaim-website
# Here you run the image to create a new container and check it
sudo docker run -p 80:80 voiceaim-website
from centos:latestrun yum install wget -y# Installs jenkinsrun wget -O /etc/yum.repos.d/jenkins.repo
run rpm --import
run yum install java-11-openjdk jenkins -y
## Installs Docker
add docker.repo /etc/yum.repos.d/
run yum install docker-ce git -y --nobest
run yum install unzip git wget -y
## download and install s2irun wget tar xvf source-to-image-v1.3.0-eed2850f-linux-amd64.tar.gz
run cp s2i /usr/local/bin/
run cp s2i /usr/bin
# starts jenkins
expose 8080
entrypoint ["java"]
cmd ["-jar", "/usr/lib/jenkins/jenkins.war", "--httpPort=8080"]
docker pull ayedaemon/s2ijenkins:1
sudo docker run -d -p 8080:8080 ayedaemon/s2ijenkins:1

But why would I ever do this?? Why we need S2I with jenkins in a container?

sudo docker run -d -p 8080:8080 -v /var/run/docker.sock:/var/run/docker.sock — name s2ijenk ayedaemon/s2ijenkins:1
mkdir -p /dockerfiless2i build . centos/python-36-centos7 ayedaemon/voiceaim_website --as-dockerfile /dockerfiles/Dockerfile
add the path to the dockerfile too (check in advance section)

Connecting the dots and rest is magic.