DEV Community

RajarshiG
RajarshiG

Posted on

💻 CI/CD Pipeline with Jenkins, Spring Boot & Docker on Windows — No Git Bash Required

I recently built a local CI/CD pipeline using Jenkins to deploy a Spring Boot application with Docker, simulating dev and QA environments. The twist? I did it entirely on Windows, using the bat command — no Git Bash or Linux dependencies!


🛠️ Stack & Tools

  • Jenkins (installed via Windows installer)
  • Spring Boot (Maven project)
  • Docker Compose (for dev & qa services)
  • GitHub (source control with PAT for authentication)
  • Windows batch scripts (bat) for Jenkins steps

🔄 Pipeline Overview

My Jenkins pipeline does the following:

  1. Pulls code from GitHub (set to main branch manually)

  2. Builds the Spring Boot app using:

   dir('backend') {
     bat 'mvnw.cmd clean package -DskipTests'
   }
Enter fullscreen mode Exit fullscreen mode
  1. Builds Docker images for both dev and QA

  2. Deploys the dev container

  3. Adds a manual input step before proceeding to QA deployment


🧪 Environments Setup with Docker Compose

Here’s a snapshot from my docker-compose.yml:

services:
  backend-dev:
    build: ./backend
    ports:
      - "8082:8080"
    environment:
      - SPRING_PROFILES_ACTIVE=dev

  backend-qa:
    build: ./backend
    ports:
      - "8083:8080"
    environment:
      - SPRING_PROFILES_ACTIVE=qa
Enter fullscreen mode Exit fullscreen mode

Each profile (application-dev.properties, application-qa.properties) gets picked up based on SPRING_PROFILES_ACTIVE.


⚠️ What I Learned

  • Jenkins on Windows uses bat, not sh
  • Use mvnw.cmd instead of ./mvnw
  • Make sure the backend directory exists in your GitHub repo, or Jenkins will break
  • GitHub no longer supports password auth — use a Personal Access Token
  • Docker COPY target/*.jar fails if the app isn’t built first!

✅ Next Goals

  • Add frontend (React)
  • Push images to GitHub Container Registry
  • Setup GitHub webhook to auto-trigger Jenkins

💬 Final Thoughts

This was my first fully local pipeline and it’s taught me more than any tutorial could. If you’re starting with Jenkins, don’t be afraid to break things — just read the logs carefully and keep experimenting.

Feel free to connect if you're working on something similar!

#Jenkins #SpringBoot #DevOps #Docker #CI_CD #Java #WindowsDeveloper #Tutorial #BuildInPublic

Top comments (0)