Sign inSign up

riteshatri/resource-management-frontend

By riteshatri

β€’Updated 9 months ago

Production-ready Docker image for Resource Management Frontend (React + Nginx)

Image
0

382

riteshatri/resource-management-frontend repository overview

β πŸš€ Resource Management Frontend (Nginx + Docker)

A production-ready, reusable frontend Docker image for the Resource Management application.

This image is designed to be generic and environment-agnostic:

  • ❌ No hard‑coded backend IPs
  • βœ… Backend configured at runtime using environment variables
  • βœ… Works with Docker, Docker Compose, and Kubernetes

⁠✨ Key Features

  • πŸ” Runtime backend configuration (no rebuild required)
  • 🐳 Multi-stage build (Node.js β†’ Nginx)
  • πŸ” Secure by design (no secrets baked into image)
  • βš™οΈ ENTRYPOINT + CMD best practices
  • πŸ“¦ Lightweight Alpine-based image
  • ☁️ Cloud & Kubernetes friendly

⁠🧠 How It Works (High Level)

Browser
   ↓
Nginx (Frontend Container)
   ↓  /api/*
Backend API (Any Host / Any Env)
  • Frontend is served by Nginx
  • All /api/* requests are reverse-proxied to the backend
  • Backend host & port are injected at container startup

⁠🐳 Image Information

  • Base Image: nginx:1.25-alpine
  • Runtime Config: envsubst (from gettext)
  • Exposed Port: 80

⁠1️⃣ Pull Image from Docker Hub
docker pull riteshatri/resource-management-frontend:latest

⁠2️⃣ Run Container (Runtime Backend Configuration)
docker run -d \
  -p 80:80 \
  -e BACKEND_HOST=10.0.0.5 \
  -e BACKEND_PORT=8000 \
  --name frontend \
  riteshatri/resource-management-frontend:latest

πŸ”Ή Replace BACKEND_HOST and BACKEND_PORT with your backend details.


β πŸ”§ Required Environment Variables

VariableDescriptionExample
BACKEND_HOSTBackend server hostname or IPbackend, 10.0.0.5
BACKEND_PORTBackend service port8000

❗ These are required at runtime. Without them, Nginx will not start correctly.


⁠πŸ§ͺ Health Check

curl http://localhost/health

Expected response:

healthy

⁠🧩 Docker Compose Example

version: "3.9"

services:
  backend:
    image: backend-app
    ports:
      - "8000:8000"

  frontend:
    image: riteshatri/resource-management-frontend:latest
    ports:
      - "80:80"
    environment:
      BACKEND_HOST: backend
      BACKEND_PORT: 8000
    depends_on:
      - backend

Run:

docker compose up -d

⁠☸️ Kubernetes (Concept)

  • Use ConfigMap for BACKEND_HOST / BACKEND_PORT
  • Inject via env: in Deployment
  • Same image works across Dev / UAT / Prod

β πŸ” Security Notes

  • ❌ No credentials inside image
  • ❌ No hard-coded IPs or URLs
  • βœ… Logs streamed to stdout / stderr
  • βœ… Graceful shutdown supported (exec nginx)

β πŸ† Best Practices Followed

  • ENTRYPOINT used for fixed startup flow
  • CMD used for runtime behavior
  • Config generated at container startup
  • Image is reusable & immutable

β πŸ‘¨β€πŸ’» Author

Ritesh Sharma
DevOps Engineer | Cloud | Docker | Azure | CI/CD


⁠⭐ Support

If this image helped you:

  • ⭐ Star the GitHub repository
  • 🐳 Pull & use the image
  • 🐞 Open issues for improvements

⁠❀️ Built with care for real-world DevOps & Cloud professionals

Tag summary

Content type

Image

Digest

sha256:79c64929a…

Size

20.8 MB

Last updated

9 months ago

docker pull riteshatri/resource-management-frontend