In my last post, I revisited the 12-Factor App Principles – a blueprint for building applications that are portable, resilient, and scalable. This post takes the next step: how do we actually build containerized apps that bring those principles to life? I have been exploring this journey for a while: starting with a Spring Boot application, applying 12-Factor discipline, and then setting up pipelines, containers, and orchestration. Here are the four high-level steps for moving from principles to practice.
1. Build the application with 12-factor principles
An app needs to be designed for the cloud from day one:
- A clean codebase tracked in version control.
- Explicitly declared dependencies (no hidden assumptions).
- Config externalized into the environment—not baked into code.
- Stateless processes that can scale horizontally.
- Logs treated as event streams, not files.
This ensures the foundation is right before we even think about containers.
2. Automate build & quality gates via CI/CD
A reliable build pipeline is the backbone of cloud-ready apps. This is where we codify consistency and quality:
- Use Maven or Gradle to manage dependencies and standardize builds.
- Leverage Jenkins to automate compilation, packaging, and artifact generation.
- Code quality checks via SonarQube (for code smells, duplication), CAST (for architecture, technical debt, and maintainability), and Checkmarx (for security vulnerabilities).
- Test coverage integrated into the pipeline to catch regressions early.
- Environment setup so dev, staging, and prod remain aligned.
This is also the right stage to embed non-functional requirements – such as security, performance, and maintainability – into the software delivery lifecycle.
3. Containerize the Application
Once the pipeline is humming, the next step is to containerize:
- Write a Dockerfile that packages our app into a lean, immutable image.
- Follow best practices: use minimal base images, avoid hardcoding secrets, and leverage multi-stage builds.
- Validate disposability: fast startup, graceful shutdown, and statelessness.
The container becomes the unit of deployment, fully aligned with the principles we started with.
4. Orchestrate & Deploy
Finally, deploy the containerized app in an orchestrated environment:
- Deploy to Kubernetes for enterprise-grade orchestration – scaling, self-healing, and rolling updates.
- Manage configuration using ConfigMaps (non-sensitive configs like DB hostnames, log levels) and Secrets (sensitive values like passwords, tokens, certificates). This approach ensures container images remain immutable, while environment-specific values are injected securely at runtime.
- Validate resilience: scale pods up and down, perform rolling upgrades, and monitor logs as event streams.
This step is where our app truly becomes cloud-native: portable across environments, scalable under load, and manageable at enterprise scale.
The 12-Factor methodology comes to life when combined with automation, containerization, and orchestration. By following these four steps, teams move from abstract principles to concrete, cloud-ready deployments.