Files
Pygentic-AI/.github/workflows/docker-image.yml
Francis Secada b129cd4f0c feat: modernize deployment pipeline for Komodo integration
Production Deployment Improvements:
- Added .env.example template for secure credential management
- Modernized Docker build workflow with branch sanitization
- Created Komodo deployment trigger workflow
- Updated compose.yaml with environment variable substitution

GitHub Workflows:
- Updated docker-image.yml:
  - Add branch name sanitization (replace / with -)
  - Generate both date-tagged and -latest Docker tags
  - Upgrade to actions/checkout@v4
  - Add pull: true for layer caching

- New komodo-deploy.yml:
  - Triggers after successful Docker Image CI
  - Sends signed webhook to Komodo service
  - Extracts and sanitizes branch names
  - Requires secrets: KOMODO_HOST, KOMODO_STACK_ID_OR_NAME, KOMODO_WEBHOOK_SECRET

Docker Compose Modernization:
- Dynamic IMAGE_TAG with sensible defaults (main-latest)
- Configurable memory limits and reservations
- Environment variable substitution for all configs
- Added container names and restart policies
- Improved healthcheck with Host header
- Updated Traefik labels with Let's Encrypt cert resolver
- Added loadbalancer server URL configuration
- Explicit command paths for reliability

Security:
- .env.example provides safe template (no credentials)
- Actual .env remains in .gitignore (not tracked)

Pattern based on proven Formana deployment architecture.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-02 16:30:10 -05:00

54 lines
1.8 KiB
YAML

name: Docker Image CI
on:
pull_request:
branches: [ "*_deploy"]
push:
branches: [ "*_deploy", "feature_*", "main" ]
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
max-parallel: 4
matrix:
python-version: [ "3.13" ]
steps:
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch
- name: Sanitize branch name for Docker tag
shell: bash
run: echo "sanitized_branch=$(echo '${{ steps.extract_branch.outputs.branch }}' | sed 's/\//-/g')" >> $GITHUB_OUTPUT
id: sanitize_branch
- name: Set SSH Agent
uses: webfactory/ssh-agent@v0.9.0
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Build the Docker image
uses: docker/build-push-action@v6
with:
ssh: |
default=${{ env.SSH_AUTH_SOCK }}
build-args: |
"GIT_BRANCH=${{ steps.extract_branch.outputs.branch }}"
push: true
tags: |
s3docker.francissecada.com/pygentic_ai:${{ steps.sanitize_branch.outputs.sanitized_branch }}.${{ steps.date.outputs.date }}
s3docker.francissecada.com/pygentic_ai:${{ steps.sanitize_branch.outputs.sanitized_branch }}-latest
pull: true