Initial commit: Complete NodeJS-native setup
- Migrated from Python pre-commit to NodeJS-native solution - Reorganized documentation structure - Set up Husky + lint-staged for efficient pre-commit hooks - Fixed Dockerfile healthcheck issue - Added comprehensive documentation index
This commit is contained in:
265
docs/deployment/DOCKER_IMAGE_CONFIGURATION.md
Normal file
265
docs/deployment/DOCKER_IMAGE_CONFIGURATION.md
Normal file
@@ -0,0 +1,265 @@
|
||||
# 🐳 Docker Image Configuration
|
||||
|
||||
## Overview
|
||||
|
||||
RxMinder now supports configurable Docker images via environment variables, enabling flexible deployment across different registries, environments, and versions.
|
||||
|
||||
## 🎯 Docker Image Variable
|
||||
|
||||
### **DOCKER_IMAGE**
|
||||
|
||||
The complete Docker image specification including registry, repository, and tag.
|
||||
|
||||
**Format:** `[registry/]repository:tag`
|
||||
|
||||
## 🌐 Registry Examples
|
||||
|
||||
### Public Registries
|
||||
|
||||
#### Docker Hub
|
||||
|
||||
```bash
|
||||
# Official image on Docker Hub
|
||||
DOCKER_IMAGE=rxminder/rxminder:latest
|
||||
DOCKER_IMAGE=rxminder/rxminder:v1.2.0
|
||||
DOCKER_IMAGE=rxminder/rxminder:stable
|
||||
```
|
||||
|
||||
#### GitHub Container Registry (ghcr.io)
|
||||
|
||||
```bash
|
||||
# GitHub Packages
|
||||
DOCKER_IMAGE=ghcr.io/username/rxminder:latest
|
||||
DOCKER_IMAGE=ghcr.io/organization/rxminder:v1.2.0
|
||||
DOCKER_IMAGE=ghcr.io/username/rxminder:dev-branch
|
||||
```
|
||||
|
||||
#### GitLab Container Registry
|
||||
|
||||
```bash
|
||||
# GitLab Registry
|
||||
DOCKER_IMAGE=registry.gitlab.com/username/rxminder:latest
|
||||
DOCKER_IMAGE=registry.gitlab.com/group/rxminder:production
|
||||
```
|
||||
|
||||
### Private/Self-Hosted Registries
|
||||
|
||||
#### Gitea Registry
|
||||
|
||||
```bash
|
||||
# Current default (Gitea)
|
||||
DOCKER_IMAGE=gitea-http.taildb3494.ts.net/will/meds:latest
|
||||
DOCKER_IMAGE=gitea-http.taildb3494.ts.net/will/meds:v1.2.0
|
||||
```
|
||||
|
||||
#### Harbor Registry
|
||||
|
||||
```bash
|
||||
# Harbor enterprise registry
|
||||
DOCKER_IMAGE=harbor.company.com/rxminder/rxminder:latest
|
||||
DOCKER_IMAGE=harbor.company.com/rxminder/rxminder:production
|
||||
```
|
||||
|
||||
#### Local Registry
|
||||
|
||||
```bash
|
||||
# Local development registry
|
||||
DOCKER_IMAGE=localhost:5000/rxminder:latest
|
||||
DOCKER_IMAGE=registry.local:5000/rxminder:dev
|
||||
```
|
||||
|
||||
### Cloud Provider Registries
|
||||
|
||||
#### AWS Elastic Container Registry (ECR)
|
||||
|
||||
```bash
|
||||
# AWS ECR
|
||||
DOCKER_IMAGE=123456789012.dkr.ecr.us-west-2.amazonaws.com/rxminder:latest
|
||||
DOCKER_IMAGE=123456789012.dkr.ecr.us-west-2.amazonaws.com/rxminder:v1.2.0
|
||||
```
|
||||
|
||||
#### Google Container Registry (GCR)
|
||||
|
||||
```bash
|
||||
# Google Cloud Registry
|
||||
DOCKER_IMAGE=gcr.io/project-id/rxminder:latest
|
||||
DOCKER_IMAGE=us.gcr.io/project-id/rxminder:production
|
||||
```
|
||||
|
||||
#### Azure Container Registry (ACR)
|
||||
|
||||
```bash
|
||||
# Azure Container Registry
|
||||
DOCKER_IMAGE=myregistry.azurecr.io/rxminder:latest
|
||||
DOCKER_IMAGE=myregistry.azurecr.io/rxminder:stable
|
||||
```
|
||||
|
||||
## 🏷️ Tagging Strategies
|
||||
|
||||
### Environment-Based Tagging
|
||||
|
||||
```bash
|
||||
# Development
|
||||
DOCKER_IMAGE=myregistry.com/rxminder:dev
|
||||
DOCKER_IMAGE=myregistry.com/rxminder:develop-20250906
|
||||
|
||||
# Staging
|
||||
DOCKER_IMAGE=myregistry.com/rxminder:staging
|
||||
DOCKER_IMAGE=myregistry.com/rxminder:release-candidate
|
||||
|
||||
# Production
|
||||
DOCKER_IMAGE=myregistry.com/rxminder:stable
|
||||
DOCKER_IMAGE=myregistry.com/rxminder:v1.2.0
|
||||
```
|
||||
|
||||
### Git-Based Tagging
|
||||
|
||||
```bash
|
||||
# Branch-based
|
||||
DOCKER_IMAGE=myregistry.com/rxminder:main
|
||||
DOCKER_IMAGE=myregistry.com/rxminder:feature-auth
|
||||
|
||||
# Commit-based
|
||||
DOCKER_IMAGE=myregistry.com/rxminder:sha-abc1234
|
||||
DOCKER_IMAGE=myregistry.com/rxminder:pr-123
|
||||
```
|
||||
|
||||
### Semantic Versioning
|
||||
|
||||
```bash
|
||||
# Semantic versions
|
||||
DOCKER_IMAGE=myregistry.com/rxminder:v1.0.0
|
||||
DOCKER_IMAGE=myregistry.com/rxminder:v1.2.3-beta
|
||||
DOCKER_IMAGE=myregistry.com/rxminder:v2.0.0-rc1
|
||||
```
|
||||
|
||||
## 🎪 Environment-Specific Configurations
|
||||
|
||||
### Development (.env)
|
||||
|
||||
```bash
|
||||
APP_NAME=rxminder-dev
|
||||
DOCKER_IMAGE=localhost:5000/rxminder:dev
|
||||
STORAGE_CLASS=local-path
|
||||
STORAGE_SIZE=5Gi
|
||||
INGRESS_HOST=rxminder-dev.local
|
||||
```
|
||||
|
||||
### Staging (.env.staging)
|
||||
|
||||
```bash
|
||||
APP_NAME=rxminder-staging
|
||||
DOCKER_IMAGE=myregistry.com/rxminder:staging
|
||||
STORAGE_CLASS=longhorn
|
||||
STORAGE_SIZE=10Gi
|
||||
INGRESS_HOST=staging.rxminder.company.com
|
||||
```
|
||||
|
||||
### Production (.env.production)
|
||||
|
||||
```bash
|
||||
APP_NAME=rxminder
|
||||
DOCKER_IMAGE=myregistry.com/rxminder:v1.2.0 # Fixed version for stability
|
||||
STORAGE_CLASS=fast-ssd
|
||||
STORAGE_SIZE=50Gi
|
||||
INGRESS_HOST=rxminder.company.com
|
||||
```
|
||||
|
||||
## 🚀 CI/CD Integration
|
||||
|
||||
### GitHub Actions Example
|
||||
|
||||
```yaml
|
||||
# .github/workflows/deploy.yml
|
||||
- name: Deploy to Kubernetes
|
||||
env:
|
||||
DOCKER_IMAGE: ghcr.io/${{ github.repository }}:${{ github.sha }}
|
||||
run: |
|
||||
echo "DOCKER_IMAGE=${DOCKER_IMAGE}" >> .env
|
||||
./scripts/k8s-deploy-template.sh deploy
|
||||
```
|
||||
|
||||
### GitLab CI Example
|
||||
|
||||
```yaml
|
||||
# .gitlab-ci.yml
|
||||
deploy:
|
||||
variables:
|
||||
DOCKER_IMAGE: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
|
||||
script:
|
||||
- echo "DOCKER_IMAGE=${DOCKER_IMAGE}" >> .env
|
||||
- ./scripts/k8s-deploy-template.sh deploy
|
||||
```
|
||||
|
||||
## 🔒 Registry Authentication
|
||||
|
||||
### Docker Registry Secrets
|
||||
|
||||
```bash
|
||||
# Create registry secret for private registries
|
||||
kubectl create secret docker-registry regcred \
|
||||
--docker-server=myregistry.com \
|
||||
--docker-username=username \
|
||||
--docker-password=password \
|
||||
--docker-email=email@company.com
|
||||
|
||||
# Update deployment to use the secret
|
||||
# (Add imagePullSecrets to deployment template if needed)
|
||||
```
|
||||
|
||||
### Cloud Provider Authentication
|
||||
|
||||
```bash
|
||||
# AWS ECR
|
||||
aws ecr get-login-password --region us-west-2 | docker login --username AWS --password-stdin 123456789012.dkr.ecr.us-west-2.amazonaws.com
|
||||
|
||||
# Google GCR
|
||||
gcloud auth configure-docker
|
||||
|
||||
# Azure ACR
|
||||
az acr login --name myregistry
|
||||
```
|
||||
|
||||
## 💡 Best Practices
|
||||
|
||||
### Production Recommendations
|
||||
|
||||
- ✅ **Use specific tags** (not `:latest`) for production
|
||||
- ✅ **Pin to exact versions** for stability
|
||||
- ✅ **Use semantic versioning** for releases
|
||||
- ✅ **Separate registries** for different environments
|
||||
- ✅ **Enable vulnerability scanning** on registries
|
||||
|
||||
### Development Workflow
|
||||
|
||||
- ✅ **Use `:dev` or `:latest`** for development
|
||||
- ✅ **Branch-based tags** for feature development
|
||||
- ✅ **Local registries** for fast iteration
|
||||
- ✅ **Automated builds** on code changes
|
||||
|
||||
### Security Considerations
|
||||
|
||||
- ✅ **Private registries** for proprietary code
|
||||
- ✅ **Registry authentication** properly configured
|
||||
- ✅ **Image scanning** for vulnerabilities
|
||||
- ✅ **Supply chain security** with signed images
|
||||
|
||||
## 🎭 Example Deployments
|
||||
|
||||
### Multi-Environment Setup
|
||||
|
||||
```bash
|
||||
# Development
|
||||
export DOCKER_IMAGE=localhost:5000/rxminder:dev
|
||||
./scripts/k8s-deploy-template.sh deploy
|
||||
|
||||
# Staging
|
||||
export DOCKER_IMAGE=registry.company.com/rxminder:staging
|
||||
./scripts/k8s-deploy-template.sh deploy
|
||||
|
||||
# Production
|
||||
export DOCKER_IMAGE=registry.company.com/rxminder:v1.2.0
|
||||
./scripts/k8s-deploy-template.sh deploy
|
||||
```
|
||||
|
||||
This flexible Docker image configuration makes RxMinder truly **portable** and **CI/CD-ready** across any container registry and deployment environment!
|
||||
Reference in New Issue
Block a user