{"id":3508,"date":"2026-11-16T14:39:22","date_gmt":"2026-11-16T19:39:22","guid":{"rendered":"https:\/\/bluegalaxy.info\/codewalk\/?p=3508"},"modified":"2026-11-16T15:10:49","modified_gmt":"2026-11-16T20:10:49","slug":"how-to-set-up-ci-cd","status":"publish","type":"post","link":"https:\/\/bluegalaxy.info\/codewalk\/2026\/11\/16\/how-to-set-up-ci-cd\/","title":{"rendered":"How to set up CI\/CD"},"content":{"rendered":"\n<h4 class=\"wp-block-heading\">What is CI\/CD?<\/h4>\n\n\n\n<p><code>CI<\/code> stands for <code>Continuous Integration<\/code>. <code>CD<\/code> stands for <code>Continuous Delivery<\/code>.<\/p>\n\n\n\n<p><code>Continuous Integration<\/code> means developers merge code frequently into a shared repository and every change is automatically validated through builds and tests.<\/p>\n\n\n\n<p><code>Continuous Delivery<\/code> means the software is always deployable.<\/p>\n\n\n\n<p>Modern CI\/CD pipelines frequently use Docker containers to package and deploy applications.* <code>Docker<\/code> is used because it packages a snapshot of an application and all of its dependencies into a portable image. This ensures the application behaves the same way in development, testing, staging, and production environments. <code>Docker<\/code> also makes deployments predictable, repeatable, and easy to roll back if a release introduces issues.<\/p>\n\n\n\n<p>Note: For the sake of this article, we are going to use the Docker example, which is common for CI\/CD but is not always used. It is possible to implement CI\/CD pipelines without Docker. For example:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Android APK deployments<\/li>\n\n\n\n<li>iOS deployments<\/li>\n\n\n\n<li>Traditional .NET IIS deployments<\/li>\n\n\n\n<li>Serverless deployments<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">How to set it up<\/h4>\n\n\n\n<p>Here is how a <code>CI\/CD<\/code> pipeline is typically set up:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Developer pushes code.<\/li>\n\n\n\n<li>Automated tests run (<code>CI<\/code>).<\/li>\n\n\n\n<li>Docker builds an image containing the application and its dependencies.<\/li>\n\n\n\n<li>The image is stored in a <code>Docker<\/code> registry for deployment.<\/li>\n\n\n\n<li>Production servers download the <code>Docker<\/code> image.<\/li>\n\n\n\n<li>The new version goes live.<\/li>\n<\/ol>\n\n\n\n<p>Here is a small example of a basic CI\/CD pipeline setup. It involves creating a GitHub Actions workflow (<strong>deploy.yml<\/strong>) and a deployment script (<strong>deploy.sh<\/strong>).<\/p>\n\n\n\n<p>Whenever code is pushed to the main branch, GitHub Actions can be set up to automatically execute the deploy.yml deployment script. Here is what that YAML script can look like. Notice it calls the second script deploy.sh.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">name: Deploy\n\non:\n  push:\n    branches:\n      - main\n\njobs:\n  deploy:\n    runs-on: ubuntu-latest\n\n    steps:\n      - uses: actions\/checkout@v4\n\n      - name: Run deployment script\n        run: .\/deploy.sh<\/pre>\n\n\n\n<p>Then the deploy.sh script can be set up like this:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">#!\/bin\/bash\n\necho \"Running tests...\"\npytest\n\necho \"Building Docker image...\"\ndocker build -t myapp:latest .\n\necho \"Pushing image to registry...\"\ndocker push myapp:latest\n\necho \"Deploying latest version...\"\nssh prod-server \"\n    docker pull myapp:latest &amp;&amp;\n    docker compose up -d\n\"<\/pre>\n\n\n\n<p>These two scripts together form a basic CI\/CD pipeline:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">git push\n    \u2193\nGitHub Actions starts\n    \u2193\ndeploy.sh runs\n    \u2193\nTests execute\n    \u2193\nDocker image built\n    \u2193\nImage stored in registry\n    \u2193\nProduction server downloads image\n    \u2193\nApplication restarts\n    \u2193\nUsers see the update<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Some notes about Docker<\/h4>\n\n\n\n<p>A Docker build creates an &#8220;image&#8221;. The command <code>docker run<\/code> creates a docker &#8220;container&#8221;.<\/p>\n\n\n\n<p>A Docker Image is a blueprint of the code and its dependencies. A Docker Container is a running instance.<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>What is CI\/CD? CI stands for Continuous Integration. CD stands for Continuous Delivery. Continuous Integration means developers merge code frequently into a shared repository and every change is automatically validated through builds and tests. Continuous Delivery means the software is always deployable. Modern CI\/CD pipelines frequently use Docker containers to package and deploy applications.* Docker &hellip; <a href=\"https:\/\/bluegalaxy.info\/codewalk\/2026\/11\/16\/how-to-set-up-ci-cd\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">How to set up CI\/CD<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[230],"tags":[232,231,233,236,234,237],"class_list":["post-3508","post","type-post","status-publish","format-standard","hentry","category-devops","tag-cd","tag-ci","tag-ci-cd","tag-continuous-delivery","tag-continuous-integration","tag-docker"],"_links":{"self":[{"href":"https:\/\/bluegalaxy.info\/codewalk\/wp-json\/wp\/v2\/posts\/3508","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bluegalaxy.info\/codewalk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bluegalaxy.info\/codewalk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bluegalaxy.info\/codewalk\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bluegalaxy.info\/codewalk\/wp-json\/wp\/v2\/comments?post=3508"}],"version-history":[{"count":10,"href":"https:\/\/bluegalaxy.info\/codewalk\/wp-json\/wp\/v2\/posts\/3508\/revisions"}],"predecessor-version":[{"id":3521,"href":"https:\/\/bluegalaxy.info\/codewalk\/wp-json\/wp\/v2\/posts\/3508\/revisions\/3521"}],"wp:attachment":[{"href":"https:\/\/bluegalaxy.info\/codewalk\/wp-json\/wp\/v2\/media?parent=3508"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bluegalaxy.info\/codewalk\/wp-json\/wp\/v2\/categories?post=3508"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bluegalaxy.info\/codewalk\/wp-json\/wp\/v2\/tags?post=3508"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}