Skip to content

Commit

Permalink
commented deplay jobs from workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
danish-kv committed Nov 1, 2024
1 parent 88cfc34 commit 23f8047
Showing 1 changed file with 27 additions and 27 deletions.
54 changes: 27 additions & 27 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,30 +30,30 @@ jobs:
tags: ${{ secrets.DOCKER_USERNAME }}/backend-web:latest


deploy:
needs: build-and-share
runs-on: ubuntu-latest
steps:
- name: Checkout 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: eu-north-1

- name: Deploy to EC2
env:
PRIVATE_KEY: ${{ secrets.EC2_SSH_PRIVATE_KEY }}
HOST: ${{ secrets.EC2_HOST }}
USER: ${{ secrets.EC2_USER }}
run: |
echo "$PRIVATE_KEY" > private_key && chmod 600 private_key
ssh -o StrictHostKeyChecking=no -i private_key ${USER}@${HOST} '
sudo docker compose pull &&
sudo docker compose up -d &&
sudo docker image prune -f &&
sudo systemctl restart nginx
'
# deploy:
# needs: build-and-share
# runs-on: ubuntu-latest
# steps:
# - name: Checkout 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: eu-north-1

# - name: Deploy to EC2
# env:
# PRIVATE_KEY: ${{ secrets.EC2_SSH_PRIVATE_KEY }}
# HOST: ${{ secrets.EC2_HOST }}
# USER: ${{ secrets.EC2_USER }}
# run: |
# echo "$PRIVATE_KEY" > private_key && chmod 600 private_key
# ssh -o StrictHostKeyChecking=no -i private_key ${USER}@${HOST} '
# sudo docker compose pull &&
# sudo docker compose up -d &&
# sudo docker image prune -f &&
# sudo systemctl restart nginx
# '

0 comments on commit 23f8047

Please sign in to comment.