more controller fixes #46
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy to Production | |
| on: | |
| push: | |
| branches: | |
| - multitenancy | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Checkout source code | |
| uses: actions/checkout@v3 | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v1 | |
| with: | |
| aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| aws-region: us-east-1 | |
| - name: Login to Amazon ECR | |
| id: login-ecr | |
| uses: aws-actions/amazon-ecr-login@v1 | |
| - name: Set up Docker Buildx (for multi-platform builds) | |
| uses: docker/setup-buildx-action@v2 | |
| - name: Build, tag, and push image to Amazon ECR | |
| env: | |
| ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | |
| ECR_REPOSITORY: finishline-production | |
| IMAGE_TAG: ${{ github.sha }} | |
| run: | | |
| echo "Building Docker image for AMD64 architecture..." | |
| # Build for AMD64 architecture (t3.small instances are AMD64) | |
| docker buildx build \ | |
| --platform linux/amd64 \ | |
| --tag $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG \ | |
| --tag $ECR_REGISTRY/$ECR_REPOSITORY:latest \ | |
| --push \ | |
| . | |
| echo "✅ Image pushed successfully" | |
| echo "Image: $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" | |
| - name: Update Dockerrun.aws.json | |
| env: | |
| ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | |
| ECR_REPOSITORY: finishline-production | |
| IMAGE_TAG: ${{ github.sha }} | |
| run: | | |
| # Create a deployment-specific Dockerrun.aws.json with the commit SHA | |
| cat > Dockerrun.aws.json <<EOF | |
| { | |
| "AWSEBDockerrunVersion": "1", | |
| "Image": { | |
| "Name": "$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG", | |
| "Update": "true" | |
| }, | |
| "Ports": [ | |
| { | |
| "ContainerPort": 3001, | |
| "HostPort": 3001 | |
| } | |
| ] | |
| } | |
| EOF | |
| echo "✅ Dockerrun.aws.json updated with image tag: $IMAGE_TAG" | |
| - name: Create deployment package | |
| run: | | |
| # Include .ebextensions for health check configuration | |
| zip -r deploy.zip Dockerrun.aws.json .ebextensions/ .ebignore | |
| echo "✅ Deployment package created" | |
| - name: Deploy to Elastic Beanstalk | |
| uses: einaregilsson/beanstalk-deploy@v21 | |
| with: | |
| aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| application_name: finishline-production | |
| environment_name: finishline-production-env | |
| version_label: ${{ github.sha }} | |
| region: us-east-1 | |
| deployment_package: deploy.zip | |
| wait_for_deployment: true | |
| wait_for_environment_recovery: 300 | |
| - name: Verify deployment | |
| run: | | |
| echo "🎉 Deployment completed successfully!" | |
| echo "" | |
| echo "Deployment Details:" | |
| echo " Image: ${{ steps.login-ecr.outputs.registry }}/finishline-production:${{ github.sha }}" | |
| echo " Version: ${{ github.sha }}" | |
| echo " Environment: finishline-production-env" |