Skip to content

VanishaParwal/docker-blueprints

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

My 2025 Docker Blueprints

This repository contains my tested, production-ready Dockerfile blueprints for three common backend stacks. This is the companion repo for my "2025 Docker Roadmap" post on LinkedIn.

Each blueprint follows modern, secure practices:

  • Multi-Stage Builds: To create small, clean production images.
  • Non-Root Users: To enhance security by following the principle of least privilege.
  • Minimal Base Images: (alpine, -slim) to reduce attack surfaces.

📂 Repository Structure

docker-blueprints/
│
├── python/              # Flask + Gunicorn app
├── node/                # Express.js app
├── java/                # Spring Boot app
│
└── compose-stack/       # Orchestration logic
    ├── docker-compose.yml
    └── .env.example
---

## Projects

* `python/`: A "Hello, World" Flask app served with Gunicorn.
* `java/`: A "Hello, World" Spring Boot app.
* `node/`: A "Hello, World" Express.js app.

🐍 1. Python (Flask/Gunicorn)

  • Files: Dockerfile, app.py, requirements.txt

How to Run:

# 1. Go to the python directory
cd python

# 2. Build the image
docker build -t my-python-app .

# 3. Run the container
docker run -d -p 5000:5000 --name python-test my-python-app

Verify at: http://localhost:5000


☕ 2. Java (Spring Boot)

  • Files: Dockerfile, pom.xml, src/...

How to Run:

# 1. Go to the java directory
cd java

# 2. Build the image
docker build -t my-java-app .

# 3. Run the container
docker run -d -p 8080:8080 --name java-test my-java-app

Verify at: http://localhost:8080/hello


🖥️ 3. Node.js (Express)

  • Files: Dockerfile, index.js, package.json

How to Run:

# 1. Go to the node directory
cd node

# 2. Build the image
docker build -t my-node-app .

# 3. Run the container
docker run -d -p 3000:3000 --name node-test my-node-app

Verify at: http://localhost:3000


🌳 Cleanup (How to Stop & Remove Containers)

After you're done, here's how to clean up your running containers.

To stop and remove a single container:

# Stop the container
docker stop python-test

# Remove the container
docker rm python-test

To stop and remove ALL three:

docker stop python-test java-test node-test
docker rm python-test java-test node-test

# 2. 🚀 Running the Complete Stack (Docker Compose)

The full "Apartment Complex" (orchestration) lives inside the compose-stack/ directory. This spins up all three services plus a Postgres database, connected via a private network.

Step 1: Configuration

Navigate to the compose directory and create your environment file:

cd compose-stack
cp .env.example .env

Open .env and set your secure credentials (or use the defaults for local dev):

 POSTGRES_USER=youruser
 POSTGRES_PASSWORD=yourpassword
 POSTGRES_DB=yourdb
 DATABASE_URL=postgresql://youruser:yourpassword@db:5432/yourdb

Step 2: Launch

Build and start the entire system in detached mode:

docker compose up --build -d

Step 3: ManagementView Logs (Real-time):

docker compose logs -f

Stop & Clean Up:

# Stops containers and removes the private network & volumes
docker compose down -v

🌐 Networking & Architecture

  • Inside Docker Compose, containers communicate using Service Discovery. They resolve IP addresses by their service name, not hardcoded IPs.
  • Python connects to the database at hostname: dbNode could call the Java service at hostname: java.
  • This creates a portable environment that works exactly the same on your laptop as it does in the cloud.

🛡️Why These Blueprints?

These configurations follow the "2025 Roadmap" for containerization: text

  • ✅ Multi-stage builds: Separating build tools from runtime artifacts.
  • ✅ Non-root users: Enforcing the Principle of Least Privilege.
  • ✅ Minimal Base Images: Using alpine and slim variants to reduce vulnerabilities.
  • ✅ No Secrets in Dockerfiles: All credentials injected at runtime via .env.
  • ✅ Immutable Infrastructure: "Cattle, not Pets" mindset.

LicenseMIT © Vanisha ParwalYou are free to use, modify, and build upon these blueprints for your own projects.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors