Skip to content

Commit abd58ee

Browse files
authored
GitHub Actions 초기 설정
* Create deploy.yml * Update deploy.yml
1 parent eb94f92 commit abd58ee

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Deploy React App to EC2 via Docker Compose
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- feature/build
8+
workflow_dispatch:
9+
10+
jobs:
11+
deploy:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout source
16+
uses: actions/checkout@v4
17+
18+
- name: Upload files to EC2
19+
uses: appleboy/scp-action@v0.1.7
20+
with:
21+
host: ${{ secrets.EC2_HOST }}
22+
username: ${{ secrets.EC2_USER }}
23+
key: ${{ secrets.EC2_SSH_KEY }}
24+
source: "."
25+
target: "~/ground-hub/frontend/frontend_build/OVERLAB_FE-feature-build/front-end" # 배포 위치 (원하는 경로로 변경 가능)
26+
27+
- name: SSH to EC2 and deploy
28+
uses: appleboy/ssh-action@v1.0.3
29+
with:
30+
host: ${{ secrets.EC2_HOST }}
31+
username: ${{ secrets.EC2_USER }}
32+
key: ${{ secrets.EC2_SSH_KEY }}
33+
script: |
34+
cd ~/ground-hub/docker
35+
docker-compose -f docker-compose.yml down frontend || true
36+
docker compose -f docker-compose.yml build frontend
37+
docker compose -f docker-compose.yml up frontend -d

0 commit comments

Comments
 (0)