Skip to content

Commit 401cd12

Browse files
committed
chore: update .gitignore to exclude .env files and add GitHub Actions workflow for EC2 deployment
1 parent 8a75675 commit 401cd12

3 files changed

Lines changed: 30 additions & 4 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Deploy to EC2
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
deploy:
10+
runs-on: self-hosted
11+
12+
steps:
13+
- name: Checkout Repository
14+
uses: actions/checkout@v3
15+
16+
- name: Stop and remove existing containers
17+
run: |
18+
cd ~/DevCamper-API
19+
sudo docker-compose down || true
20+
21+
- name: Pull latest changes
22+
run: |
23+
cd ~/DevCamper-API
24+
git pull origin main
25+
26+
- name: Build and start containers
27+
run: |
28+
cd ~/DevCamper-API
29+
sudo docker-compose up --build -d

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ node_modules/
33
**.swp
44
**.swo
55
**.rdb
6+
**.env

docker-compose.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ services:
1515
container_name: devcamper
1616
depends_on:
1717
- redis
18-
environment:
19-
- REDIS_HOST=redis
20-
- REDIS_PORT=6379
21-
- REDIS_SET_EXPIRE=3600
2218
ports:
2319
- '3001:3001'
2420

0 commit comments

Comments
 (0)