We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 329e687 commit fc28fb6Copy full SHA for fc28fb6
.github/workflows/deploy.yml
@@ -0,0 +1,28 @@
1
+name: Deploy to EC2
2
+
3
+on:
4
+ push:
5
+ branches: [main, testing]
6
7
+jobs:
8
+ deploy:
9
+ runs-on: ubuntu-latest
10
11
+ steps:
12
+ - name: Checkout code
13
+ uses: actions/checkout@v4
14
15
+ - name: Add SSH key
16
+ uses: webfactory/[email protected]
17
+ with:
18
+ ssh-private-key: ${{ secrets.AWS_EC2_SSH_PRIVATE_KEY }}
19
20
+ - name: Copy files and deploy
21
+ run: |
22
+ ssh -o StrictHostKeyChecking=no ${{ secrets.AWS_EC2_SSH_USERNAME }}@${{ secrets.AWS_EC2_SSH_HOST }} << 'EOF'
23
+ cd ~/website
24
+ git pull origin main
25
+ docker build -t website .
26
+ docker stop website || true && docker rm website || true
27
+ docker run -d --name website -p 80:3000 website
28
+ EOF
0 commit comments