Skip to content

Add gunicorn in requirements.txt #13

Add gunicorn in requirements.txt

Add gunicorn in requirements.txt #13

Workflow file for this run

name: CI/CD Pipeline
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
environment: Staging
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
# - name: Lint with flake8
# run: |
# pip install flake8
# flake8 .
- 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: eu-west-3
- name: Login to AWS ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Build, tag, and push Docker image
env:
IMAGE_URI: ${{ steps.login-ecr.outputs.registry }}/twitter_light:latest
#IMAGE_URI: ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.eu-west-3.amazonaws.com/twitter_light:latest
run: |
docker build -t $IMAGE_URI .
docker push $IMAGE_URI
- name: Deploy to ECS
env:
AWS_DEFAULT_REGION: eu-west-3
ECS_CLUSTER_NAME: twitter-stage-cluster
ECS_SERVICE_NAME: twitter-stage-service
IMAGE_URI: ${{ steps.login-ecr.outputs.registry }}/twitter_light:latest
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: |
aws ecs update-service --cluster $ECS_CLUSTER_NAME --service $ECS_SERVICE_NAME --force-new-deployment