CICD Pipeline Part1
Category : DevOps Tag : 101series streamlit docker
June 1, 2021, midnight

Short Description :
CICD explanation. Part 1 focuses on how to locally create a docker container using python streamlit
source : datak

<h1>About the series</h1><p>CICD (Continuous Improvement and Continuous Delivery) is a acronym used in DevOps recently. CICD pipeline is an automation for CI and CD practices from git push to application deployment. The series explains end-to-end system settings on CICD using one demo application (<a href="https://github.com/Tak113/streamlit_ef_mc" target="_blank">git repo</a>). This articles assume user have a knowledge of github(<a href="https://datak.biz/blog/detail/7/" target="_blank">Github Basics</a>)&nbsp;and docker.</p><ol><li>Part1 : CICD basics and Docker settings using streamlit app</li><li>Part2 : CICD script/pipeline using travis and AWS elastic beanstalk</li><li>Part3 : Automation demo and Sub-domain assignment : AWS EB, Git IO, and Firebase using google domain</li></ol><h2>What is Continuous Integration (CI) ?</h2><p>Continuous Integration is commonly understood as a development effort for regularly integrating code into a branch in a git. This is to avoid traditional problem of 'merge day' from projects split to each project team members, which frequently messed up in a entire view.</p><h2>What is Continuous Delivery (CD) ?</h2><p>Continuous delivery packages up the code into a deliverable unit that can then be deployed by the developers themselves or by a separate operations team if necessary. This technical definition, though, is not much intended when we use CICD in a DevOps context. CD is meaning more common like 'Continuous Deployment' which refers to a process that automatically deploys changes to production.</p><p><br></p><h2>Dockerfile set up</h2><p>Assuming you have web application locally ready. Then create dockerfile right under project directly.</p><pre># shell script cd &lt;project directly&gt;</pre><p>Make sure that you use virtual environment and list up dependencies</p><pre># shell script pip freeze &gt; requirements.txt</pre><p>Create Dockerfile.</p><pre># shell script vim Dockerfile</pre><p>Dockerfile includes following scripts.</p><pre># Dockerfile #fetch base image FROM python:3.8-slim-buster #change working directory to /usr/app WORKDIR ./usr/app #copy requirement.txt to /usr/app in docker COPY requirement.txt ./ #install dependency '-r' means 'force' RUN pip install -r requirements.txt #specify port for streamtlit. default for streamlit is 8501 EXPOSE 8501 #copy remaining application contents of the pp into a docker directory. split COPY will speed up as `pip install requirements.txt` takes most of time and we would not like to re-run the code every time the app code is edited COPY ./ ./ #execution command when container starts CMD ["streamlit", "run", "app.py(or starter python file)"]</pre><p><br></p><h2>Docker Test</h2><p>Before integrate into CICD script, test docker module level to see if the application works correctly in a container</p><pre># shell script cd &lt;project directly&gt; docker build -t &lt;docker name&gt;/&lt;docker repo name&gt; . docker run -p 8501:8501 &lt;docker name&gt;/&lt;docker repo name&gt;</pre><p><br></p><p><br></p><p><br></p>


<< Back to Blog Posts
Back to Home

Related Posts

Docker 101 : Basic Commands
Nov 28 2020
Basic commands for docker operation, such as build, run, and going into container etc.
Jupytor in Docker
Feb 2 2021
How to deploy jupytor in docker container
CICD Pipeline Part3
Jun 2 2021
CICD explanation. Part3 includes demo on CICD pipeline automation
CICD Pipeline Part2
Jun 1 2021
CICD explanation. Part 2 focuses on how to create CICD script using travis and setup AWS EB
CICD Pipeline Part4
Jun 2 2021
CICD explanation. Part4 includes sub-domain assignment using google domain



© DATAK 2024