Skip to content

Commit

Permalink
ci: deploy.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Lee-Dongwook committed Oct 19, 2024
1 parent dfe7b65 commit 56fc839
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Deploy to EC2

on:
push:
branches:
- main

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and push Docker images
run: |
docker-compose -f docker-compose.yml build
docker-compose -f docker-compose.yml push
- name: Deploy to EC2
uses: appleboy/[email protected]
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USER }}
key: ${{ secrets.EC2_KEY }}
port: 22
script: |
cd /path/to/your/app
git pull origin main
docker-compose down
docker-compose up -d

0 comments on commit 56fc839

Please sign in to comment.