Skip to content

Docker Deployment

Docker containerization for Certana components.

Docker Images

Backend Dockerfile

FROM python:3.11-slim

WORKDIR /app

COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY . .

EXPOSE 8000

CMD ["uvicorn", "src.main:app", "--host", "0.0.0.0"]

Build and Push

docker build -t certana-backend:1.0.0 .
docker tag certana-backend:1.0.0 registry.example.com/certana-backend:1.0.0
docker push registry.example.com/certana-backend:1.0.0

Docker Compose

version: '3.9'

services:
  backend:
    image: certana-backend:latest
    ports:
      - "8000:8000"
    depends_on:
      - db
      - redis

  db:
    image: postgres:15-alpine
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD}

  redis:
    image: redis:7-alpine

Running Containers

# Start all services
docker-compose up -d

# View logs
docker-compose logs -f backend

# Stop services
docker-compose down

# Clean up
docker-compose down -v  # Remove volumes

Health Checks

services:
  backend:
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
      interval: 30s
      timeout: 10s
      retries: 3

Registry Configuration

Set up private container registry: - AWS ECR - Docker Hub - GitLab Container Registry - Google Container Registry

See Deployment Guide for full setup.