Skip to content

Fix Docker build process and YAML syntax #95

Fix Docker build process and YAML syntax

Fix Docker build process and YAML syntax #95

Workflow file for this run

name: Deploy Pathfinder
on:
push:
branches: [main]
workflow_dispatch: # Allow manual triggers
env:
AWS_REGION: us-east-1
jobs:
deploy:
name: Deploy Infrastructure and Application
runs-on: ubuntu-latest
permissions:
id-token: write # Required for OIDC
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_DEPLOY_ROLE_ARN }}
aws-region: ${{ env.AWS_REGION }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: 'apps/infra/package-lock.json'
- name: Install Pulumi CLI
uses: pulumi/actions@v4
- name: Install infrastructure dependencies
run: |
cd apps/infra
npm ci
- name: Update infrastructure
run: |
cd apps/infra
pulumi up --yes
env:
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}
NODE_ENV: production
- name: Wait for infrastructure stabilization
run: sleep 30
- name: Build and deploy application
run: |
echo "🔨 Building application (includes migrations, Next.js build, and Docker packaging)"
BUILD_ID=$(aws codebuild start-build \
--project-name pathfinder-app-build \
--query 'build.id' --output text)
echo "App build started: $BUILD_ID"
# Wait for app build to complete
while [ "$(aws codebuild batch-get-builds --ids $BUILD_ID --query 'builds[0].buildStatus' --output text)" = "IN_PROGRESS" ]; do
echo "Waiting for app build to complete..."
sleep 30
done
STATUS=$(aws codebuild batch-get-builds --ids $BUILD_ID --query 'builds[0].buildStatus' --output text)
if [ "$STATUS" != "SUCCEEDED" ]; then
echo "App build failed with status: $STATUS"
exit 1
fi
echo "App build completed successfully"
- name: Wait for deployment stabilization
run: |
echo "Waiting for ECS deployment to stabilize..."
aws ecs wait services-stable \
--cluster pathfinder \
--services pathfinder-app
echo "Application deployed successfully"
- name: Verify deployment
run: |
# Get ALB DNS name
ALB_DNS=$(aws elbv2 describe-load-balancers \
--names pathfinder-lb \
--query 'LoadBalancers[0].DNSName' --output text)
# Health check
curl -f "http://$ALB_DNS/health" || {
echo "Health check failed"
exit 1
}
echo "Deployment verification successful"
echo "Application URL: http://$ALB_DNS"