Skip to content

Modif region dans cicd #5

Modif region dans cicd

Modif region dans cicd #5

Workflow file for this run

name: CI/CD Pipeline
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
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: Login to AWS ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
env:
AWS_REGION: "eu-west-3"
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Build, tag, and push Docker image
env:
IMAGE_URI: ${{ steps.login-ecr.outputs.registry }}/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
ACCOUNT_ID: ${{ secrets.ACCOUNT_ID }}
SECRET_KEY: ${{ secrets.SECRET_KEY }}
run: |
aws ecs update-service --cluster $ECS_CLUSTER_NAME --service $ECS_SERVICE_NAME --force-new-deployment