-
Notifications
You must be signed in to change notification settings - Fork 0
39 lines (33 loc) · 1 KB
/
Copy pathdeploy.yml
File metadata and controls
39 lines (33 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
name: Deploy to EC2
on:
push:
branches:
- main
- production
jobs:
deploy:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Deploy to EC2
uses: appleboy/ssh-action@v1
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USER }}
key: ${{ secrets.DEPLOY_PRIVATE_KEY }}
command_timeout: 20m
script: |
set -e
cd /home/ubuntu/Anon-chat-backend || exit 1
git fetch --all
git reset --hard origin/main
yarn install --frozen-lockfile
yarn build
# Ensure docker-entrypoint.sh has execute permissions
chmod +x docker-entrypoint.sh
# Build with Docker BuildKit for better caching
DOCKER_BUILDKIT=1 docker compose build --parallel
# Start services
docker compose up -d --remove-orphans