Day 5 of 5
⏱ ~60 minutes
Docker and Cloud for AI — Day 5

CI/CD: Automated Deployments on Every Push

Day 5 sets up GitHub Actions to automatically rebuild and redeploy your app whenever you push code. One push, one deployment — no manual steps.

The CI/CD Pipeline

CI/CD (Continuous Integration/Continuous Deployment) means: every push to main automatically tests your code, builds a new Docker image, and deploys it. Here is the GitHub Actions workflow:

.github/workflows/deploy.yml
name: Build and Deploy

on:
  push:
    branches: [main]

env:
  AWS_REGION: us-east-1
  ECR_REPOSITORY: my-ai-app
  APP_RUNNER_SERVICE: my-ai-app-service

jobs:
  deploy:
    runs-on: ubuntu-latest
    
    steps:
    - name: Checkout code
      uses: actions/checkout@v4
    
    - name: Configure AWS credentials
      uses: aws-actions/configure-aws-credentials@v4
      with:
        aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
        aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
        aws-region: ${{ env.AWS_REGION }}
    
    - name: Login to Amazon ECR
      id: login-ecr
      uses: aws-actions/amazon-ecr-login@v2
    
    - name: Build, tag, and push image
      env:
        ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
        IMAGE_TAG: ${{ github.sha }}
      run: |
        docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
        docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
        echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT
    
    - name: Deploy to App Runner
      uses: awslabs/amazon-app-runner-deploy@main
      with:
        service: ${{ env.APP_RUNNER_SERVICE }}
        image: ${{ steps.build.outputs.image }}
        region: ${{ env.AWS_REGION }}
        wait-for-service-stability-seconds: 180
Add GitHub Secrets
# In your GitHub repo:
# Settings → Secrets and variables → Actions → New secret

# Add these two secrets:
# AWS_ACCESS_KEY_ID     = your AWS access key
# AWS_SECRET_ACCESS_KEY = your AWS secret key

# Then push to main and watch the Actions tab
💡
Image tagging: The workflow tags images with the git commit SHA (${{ github.sha }}). This means every deployment is traceable to the exact commit that produced it — critical for debugging production issues.
Day 5 Exercise
Set Up Your CI/CD Pipeline
  1. Create .github/workflows/deploy.yml with the workflow above.
  2. Add AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY to GitHub Secrets.
  3. Make a small change to your app (update a message or add a comment).
  4. Push to main and watch the Actions tab in GitHub.
  5. Once deployed, verify the change is live at your App Runner URL.

Course Complete — Production AI Deployment

  • Containerized AI app that runs identically in dev and production.
  • Docker Compose for local multi-service development (API + database + cache).
  • AWS ECR + App Runner for managed production hosting with auto-scaling.
  • GitHub Actions CI/CD that deploys on every push to main.

Want to go deeper in 3 days?

Our in-person AI bootcamp covers advanced AI development, agentic systems, and production deployment. Five cities. $1,490.

Reserve Your Seat →
Finished this lesson?