Production-ready FastAPI backend for Resource Management System with Azure SQL support
1.5K
This repository provides a production-grade Docker image for the Resource Management Backend, built using FastAPI, Gunicorn, and Azure SQL.
This Repository overview is written A to Z, so that anyone can:
This Docker image runs a FastAPI backend application that:
The application runs using:
<!-- -->
riteshatri/resource-management-backend
Docker Hub https://hub.docker.com/r/riteshatri/resource-management-backend
Exposed Port
<!-- -->
8000
When the container starts:
/health endpoint confirms service statusNo manual command, no systemd, no SSH required.
You only need:
sudo apt update
sudo apt install -y docker.io
sudo systemctl enable docker
sudo systemctl start docker
This application does NOT work without environment variables.
Create a file named .env in any directory on your server.
.env file# ==============================
# Azure SQL Database Configuration
# ==============================
AZURE_SQL_SERVER=your-server.database.windows.net
AZURE_SQL_DATABASE=your-database-name
AZURE_SQL_USERNAME=your-db-username
AZURE_SQL_PASSWORD=your-db-password
# ==============================
# Security / JWT Configuration
# ==============================
SECRET_KEY=your-very-long-random-secret-key
ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=30
# ==============================
# CORS & Frontend
# ==============================
CORS_ORIGINS=["*"]
FRONTEND_URL=http://your-frontend-url:frontendPort
If you don't already have a secret key, generate one using Python:
python3 -c "import secrets; print(secrets.token_hex(32))"
This guide explains the simplest and safest way to generate a
SECRET_KEY on Windows using PowerShell, without installing Python or any extra tools.
SECRET_KEY on Windows (PowerShell)Press:
Win + X → Windows PowerShell
[System.Guid]::NewGuid().ToString("N")
9f7c1b3c5e8a4f0b8d5c1a6e9f4a7b2c
For production environments, generate a stronger secret:
SECRET_KEY=9f7c1b3c5e8a4f0b8d5c1a6e9f4a7b2c8d1a7f9c5e4b2a6d9f0c1e3a4b5
✅ This is secure enough for production JWT signing.
SECRET_KEYSECRET_KEY to GitHubSECRET_KEY across projects.env or secret managers✅ No Python
✅ No installation required
✅ 100% Windows native solution
.env.env to GitHub.env inside Docker imagedocker pull riteshatri/resource-management-backend:latest
docker run -d --name resource-backend --env-file .env -p 8000:8000 --restart unless-stopped riteshatri/resource-management-backend:latest
Flag Purpose
-d Run in background
--env-file .env Inject environment variables
-p 8000:8000 Expose API
--restart unless-stopped Auto-start on reboot
--name Easy container management
Once container is running:
curl http://localhost:8000/health
Expected response:
{"status":"healthy"}
This confirms: - App started correctly - Database connection is working
View live logs:
docker logs -f resource-backend
Restart container:
docker restart resource-backend
Stop container:
docker stop resource-backend
When a new version is released:
docker pull riteshatri/resource-management-backend:latest
docker stop resource-backend
docker rm resource-backend
docker run -d --name resource-backend --env-file .env -p 8000:8000 --restart unless-stopped riteshatri/resource-management-backend:latest
No data loss, no reconfiguration.
⭐ If this Docker image helps you, please consider starring the GitHub repository.
Content type
Image
Digest
sha256:e89ebc941…
Size
84.4 MB
Last updated
9 months ago
docker pull riteshatri/resource-management-backend