Skip to content

Commit

Permalink
Merge pull request #17 from matheusdoedev/feat/aws
Browse files Browse the repository at this point in the history
feat: it update deploy workflow
  • Loading branch information
matheusdoedev authored Sep 28, 2023
2 parents c97f632 + 6a7f3a6 commit 694ee79
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches: ['master']

env:
CONTAINER_NAME: medical-supplier-name
CONTAINER_NAME: medical-supplier-manager
CONTAINER_TAG: latest

permissions:
Expand Down Expand Up @@ -40,13 +40,17 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: SSH Deploy
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.AWS_EC2_HOST }}
username: ${{ secrets.AWS_EC2_USERNAME }}
key: ${{ secrets.SSH_KEY }}
port: ${{ secrets.SSH_PORT }}
script: |
sudo docker pull ${{ secrets.DOCKER_USERNAME }}/${{ env.CONTAINER_NAME }}
sudo docker run -d -p 80:80 ${{ secrets.DOCKER_USERNAME }}/${{ env.CONTAINER_NAME }}
- name: Creating a private key
run: |
mkdir ~/.ssh
echo ${{ secrets.SSH_KEY }} > ~/.ssh/id_rsa
chmod 400 ~/.ssh/id_rsa
- name: Acessing EC2 instance
run: ssh -i ~/.ssh/id_rsa ${{ secrets.AWS_EC2_USERNAME }}@${{ secrets.AWS_EC2_HOST }}

- name: Pulling docker image
run: sudo docker pull ${{ secrets.DOCKER_USERNAME }}/${{ env.CONTAINER_NAME }}

- name: Running container
run: sudo docker run -d -p 80:80 ${{ secrets.DOCKER_USERNAME }}/${{ env.CONTAINER_NAME }}

0 comments on commit 694ee79

Please sign in to comment.