Skip to content

Commit

Permalink
ssh take3
Browse files Browse the repository at this point in the history
  • Loading branch information
navaneethkrishna30 committed Oct 15, 2024
1 parent 7489ba8 commit 9dae612
Showing 1 changed file with 8 additions and 25 deletions.
33 changes: 8 additions & 25 deletions .github/workflows/ci-cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,6 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.12'

- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install pylint
- name: Lint Code
run: pylint app.py || true

- name: Login to Amazon ECR
uses: aws-actions/amazon-ecr-login@v2
env:
Expand Down Expand Up @@ -63,15 +50,11 @@ jobs:
- name: Deploy via SSH
run: |
ssh -o StrictHostKeyChecking=no -i ec2_key.pem ec2-user@${{ secrets.EC2_INSTANCE_IP }}"
export BACKEND_ECR=${{ secrets.BACKEND_ECR }};
export FRONTEND_ECR=${{ secrets.FRONTEND_ECR }};
export IMAGE_TAG=${{ github.sha }};
docker-compose pull;
docker-compose up -d"
env:
BACKEND_ECR: ${{ secrets.BACKEND_ECR }}
FRONTEND_ECR: ${{ secrets.FRONTEND_ECR }}
IMAGE_TAG: ${{ github.sha }}
echo "${{ secrets.EC2_SSH_KEY }}" > ec2_key.pem
chmod 600 ec2_key.pem
ssh -o StrictHostKeyChecking=no -i ec2_key.pem ec2-user@${{ secrets.EC2_INSTANCE_IP }} \
"export BACKEND_ECR=${{ secrets.BACKEND_ECR }} && \
export FRONTEND_ECR=${{ secrets.FRONTEND_ECR }} && \
export IMAGE_TAG=${{ github.sha }} && \
docker-compose pull && \
docker-compose up -d"

0 comments on commit 9dae612

Please sign in to comment.