docs: Add Docker deployment instructions and build script

- Add build-and-push-docker.ps1 PowerShell script for automated Docker builds
- Update README.md with comprehensive Docker deployment guide
- Include environment variable configuration
- Document automated email scheduling in containers
- Add GitHub Container Registry push instructions
This commit is contained in:
nmemmert committed 2025-12-17 13:51:52 -05:00
1 parent d9784738e4
commit 27d02596d1
3 files changed
+91

No files matched your search

+3
View File
@@ -32,6 +32,9 @@ yarn-error.log*
# local env files # local env files
.env*.local .env*.local
# Firebase service account keys
firebase-service-account.json
# vercel # vercel
.vercel .vercel
+56
View File
@@ -244,6 +244,62 @@ npm run build
Deploy to Vercel or any platform supporting Next.js PWAs. Deploy to Vercel or any platform supporting Next.js PWAs.
## Docker Deployment
The app includes Docker support for containerized deployment with automated email scheduling.
### Build and Push Docker Image
1. **Using the automated script (Windows):**
```powershell
.\build-and-push-docker.ps1
```
This script will:
- Build the Docker image
- Prompt for your GitHub Personal Access Token
- Login to GitHub Container Registry
- Push the image
2. **Manual build and push:**
```bash
# Build the image
docker build -t ghcr.io/nmemmert/prayer-app:latest .
# Login to GitHub Container Registry
echo $GITHUB_TOKEN | docker login ghcr.io -u nmemmert --password-stdin
# Push the image
docker push ghcr.io/nmemmert/prayer-app:latest
```
### Run with Docker Compose
```bash
docker-compose up -d
```
The container includes:
- Automated email scheduling (runs every 5 minutes)
- Health checks
- Production-optimized Next.js build
- Cron jobs for scheduled tasks
### Environment Variables
Set these environment variables for the container:
```bash
# Firebase Admin SDK (required for server-side operations)
FIREBASE_PROJECT_ID=your_project_id
FIREBASE_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\n..."
FIREBASE_CLIENT_EMAIL=your_service_account_email
# EmailJS (for client-side emails)
NEXT_PUBLIC_EMAILJS_SERVICE_ID=your_service_id
NEXT_PUBLIC_EMAILJS_TEMPLATE_ID=your_template_id
NEXT_PUBLIC_EMAILJS_PUBLIC_KEY=your_public_key
```
## Learn More ## Learn More
To learn more about Next.js, take a look at the following resources: To learn more about Next.js, take a look at the following resources:
+32
View File
@@ -0,0 +1,32 @@
# Docker Build and Push Script for Prayer App
# Run this script to build and push the Docker container to GitHub Container Registry
Write-Host "🔨 Building Docker image..." -ForegroundColor Green
docker build -t ghcr.io/nmemmert/prayer-app:latest .
if ($LASTEXITCODE -eq 0) {
Write-Host "✅ Docker image built successfully!" -ForegroundColor Green
Write-Host "🔐 Logging into GitHub Container Registry..." -ForegroundColor Yellow
Write-Host "Please enter your GitHub Personal Access Token (with package write permissions):" -ForegroundColor Yellow
$token = Read-Host -AsSecureString
$tokenPlain = [Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($token))
echo $tokenPlain | docker login ghcr.io -u nmemmert --password-stdin
if ($LASTEXITCODE -eq 0) {
Write-Host "🚀 Pushing Docker image to GitHub Container Registry..." -ForegroundColor Green
docker push ghcr.io/nmemmert/prayer-app:latest
if ($LASTEXITCODE -eq 0) {
Write-Host "✅ Docker image pushed successfully!" -ForegroundColor Green
Write-Host "🌐 Your container is now available at: ghcr.io/nmemmert/prayer-app:latest" -ForegroundColor Cyan
} else {
Write-Host "❌ Failed to push Docker image" -ForegroundColor Red
}
} else {
Write-Host "❌ Failed to login to GitHub Container Registry" -ForegroundColor Red
}
} else {
Write-Host "❌ Failed to build Docker image" -ForegroundColor Red
}