Skip to content

confugre profile

confugre profile #8

Workflow file for this run

name: Deploy Ello API to AWS ECS Production Environment
# run on PR merged into main branch
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- 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: eu-west-1
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
with:
mask-password: 'false'
# create an .env file and add the following variables PORT=9007
- name: touch .env
run: |
touch .env
echo "PORT=9007" >> .env
- name: Build and Push Docker Image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
run: |
docker build -t $ECR_REGISTRY/ecr_ellotest_repo:latest .
docker push $ECR_REGISTRY/ecr_ellotest_repo:latest
- name: Set up Terraform
uses: hashicorp/setup-terraform@v2
with:
terraform_version: "1.1.7"
- name: Add profile credentials to ~/.aws/credentials
run: |
aws configure set aws_access_key_id ${{ secrets.AWS_ACCESS_KEY_ID }} --profile patrick1
aws configure set aws_secret_access_key ${{ secrets.AWS_SECRET_ACCESS_KEY }} --profile patrick1
- name: Initialize Terraform
run: cd deployment && terraform init
- name: Plan Changes
run: cd deployment && terraform plan
- name: Apply Changes
run: cd deployment && terraform apply -auto-approve tfplan
- name: Clean Up
run: cd deployment && rm tfplan