GPT-4DevOps

مولّد تكوينات Docker Compose

مشاركة:
مولّد تكوينات Docker Compose

لماذا تهم هذه المطالبة

Docker Compose files often miss health checks, resource limits, and proper dependency ordering. This prompt ensures production-readiness from the start.

فيم نستخدمها

DevOps

المطالبة

Generate a Docker Compose configuration for the described architecture. Include: health checks, restart policies, volume mounts for persistence, environment variable management via .env files, proper networking between services, resource limits, and logging configuration. Add comments explaining each non-obvious configuration choice.

النتيجة

```yaml services: app: build: . restart: unless-stopped ports: ["3000:3000"] depends_on: db: { condition: service_healthy } redis: { condition: service_healthy } environment: DATABASE_URL: postgresql://app:${DB_PASSWORD}@db:5432/myapp deploy: resources: limits: { memory: 512M } healthcheck: test: ["CMD", "curl", "-f", "http://localhost:3000/health"] interval: 30s timeout: 5s retries: 3 ```

غالباً ما تفتقر ملفات Docker Compose إلى فحوصات الحالة، وحدود الموارد، والترتيب الصحيح للتبعيات. يضمن هذا التوجيه الجاهزية لبيئة الإنتاج منذ البداية. يوضح هذا التوجيه نهجاً منهجياً في مجال devops، ويُسفر عن نتائج متسقة وعالية الجودة يمكن البناء عليها بشكل تكراري.
مشاركة: