Skip to content

Phase 4: Update Docker for Namespace Packages #59

@lsetiawan

Description

@lsetiawan

Parent Issue: #54

Goal

Update Docker Compose and Dockerfile to install and run namespace packages.

Tasks

Step 4.1: Update Pixi configuration

  • Update pixi.toml to add editable installs for all namespace packages
  • Remove root pyproject.toml if it exists

Step 4.2: Update Dockerfile for namespace packages

  • Modify Dockerfile to install packages in dependency order:
    • Install datamodels first (no internal dependencies)
    • Install webservice (depends on datamodels)
    • Install pipeline (depends on datamodels)
  • Copy remaining files (alembic, configs)

Step 4.3: Refactor docker-compose.yml services

  • Keep db service (PostgreSQL)
  • Keep prefect-server service
  • Rename app service to prefect-worker
    • Runs Prefect worker for pipeline tasks
    • Command: pixi run prefect worker start --pool default-pool
  • Add new api service
    • Runs FastAPI application
    • Command: pixi run uvicorn ca_biositing.webservice.main:app --host 0.0.0.0 --port 8000
    • Exposes port 8000
    • Depends on db service
  • Ensure proper networking between all services
  • Add volume mounts for development

Step 4.4: Create docker-compose overrides

  • Create docker-compose.dev.yml
    • Enable hot reload for API
    • Mount volumes for live code changes
    • Enable debug mode
  • Create docker-compose.prod.yml (future)
    • Production optimizations

Step 4.5: Update .dockerignore

  • Create/update .dockerignore with appropriate exclusions

Step 4.6: Update environment configuration

  • Update .env.example with all required variables:
    • Database configuration
    • API configuration
    • Prefect configuration
    • Google Sheets credentials

Step 4.7: Test full stack with namespace packages

  • Build containers: docker-compose build
  • Start all services: docker-compose up -d
  • Verify namespace package imports work
  • Check service health:
    • Database
    • Prefect server
    • API
    • Prefect worker
  • Run database migrations: docker-compose exec api alembic upgrade head
  • Test running a flow: docker-compose exec prefect-worker python run_prefect_flow.py
  • Update documentation with new Docker commands

Success Criteria

  • All services start with docker-compose up
  • Database health check passes
  • Prefect server and worker connect successfully
  • API accessible on configured port
  • Pipeline can execute flows in container
  • Namespace packages import correctly in all containers

Dependencies

Labels

Sub-task, phase-4, docker, infrastructure

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions