OpenShift 4
Conclusion and APPENDIX
APPENDIX B Pre Requisite CICD
Welcome to this comprehensive guide on CI/CD builds. In this article, we provide an introduction to continuous integration and continuous delivery (CI/CD) using Docker for Beginners. Whether you are new to these concepts or have some experience, this guide will help you understand how to package, test, and deploy applications efficiently. For those familiar with these topics, you may also explore their application in OpenShift.
Packaging Your Application
After building your application and uploading your code to a source repository, the next step is packaging it for deployment. Consider the following examples:
Java Application:
The application is compiled into a JAR, EAR, or WAR file. In our demo, the Java application is packaged asapp.jar
. You can run it using:java -jar app.jar
Python Application:
Package using tools likedistutils
to create a compressed file that can be installed with pip:pip install app.tar.gz
Ruby Application:
Package into a gem file for distribution:gem install app.gem
Note
For a consolidated view, here are the packaging commands for different types of applications:
Overcoming Manual Setup Challenges
After packaging, running the application on a host often requires additional setup tasks such as:
- Installing the required application platform (e.g., Apache Tomcat for Java or the Python interpreter).
- Installing and configuring additional dependencies.
- Modifying configuration files and setting up system services.
- Starting the application services.
These manual steps can lead to misconfigurations or inconsistent behavior across different environments.
Leveraging Docker for Automation
To eliminate these risks, all instructions and dependencies are encapsulated into a Docker image using a Dockerfile. This approach not only streamlines the deployment process but also ensures consistency across environments. Use the following commands to build and run your Docker image:
docker build Dockerfile
docker run app
Once built, the Docker image undergoes automated testing using frameworks like Robot Framework or Selenium. These tests run predefined cases to validate that the application functions as expected. After successful tests, the image is released to consumers via a Docker repository, such as Docker Hub. Consumers can then deploy the image on container hosting and orchestration platforms like Kubernetes or other PaaS/CaaS solutions.
Understanding the Build Pipeline
The entire process from committing code, building a Docker image, testing it, releasing it on Docker Hub, and deploying it in production constitutes the build pipeline. Automation tools such as Jenkins or Bamboo drive continuous integration and continuous delivery (or deployment).
The following image illustrates a typical build pipeline that includes stages like source code management, build, test, release, and deploy. It also highlights the use of industry-standard tools like Docker, Jenkins, and Kubernetes.
CI/CD Pipeline Demo
Let’s move on to a practical demo where we add a Dockerfile to our application and configure a simple CI/CD pipeline. This demo, based on the course GitLab CI/CD: Architecting, Deploying, and Optimizing Pipelines, will walk you through the key stages:
- Source Code Management
- Automated Builds
- Testing
- Release
- Deployment
Each stage uses industry-standard tools to ensure a robust and streamlined CI/CD workflow.
Next Steps
Explore additional resources such as Kubernetes Documentation and Docker Hub for further insights into containerization and orchestration.
That’s it for this article. Stay tuned for the next lesson where we dive deeper into CI/CD practices and further automation strategies.
Watch Video
Watch video content