Skip to content

Commit ec1e540

Browse files
committed
Add deployment workflow and watchtower service to docker-compose.yml
1 parent 41eddb7 commit ec1e540

File tree

3 files changed

+39
-1
lines changed

3 files changed

+39
-1
lines changed

.github/workflows/deploy.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Deploy to Production
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
deploy:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
# Step 1: Checkout the code
14+
- name: Checkout Code
15+
uses: actions/checkout@v3
16+
17+
# Step 2: Set up SSH to connect to the VPS
18+
- name: Set up SSH
19+
uses: webfactory/[email protected]
20+
with:
21+
ssh-private-key: ${{ secrets.VPS_SSH_KEY }}
22+
23+
# Step 3: Deploy the app on the VPS
24+
- name: Deploy to VPS
25+
run: |
26+
ssh -o StrictHostKeyChecking=no ${{ secrets.VPS_USER }}@${{ secrets.VPS_HOST }} << 'EOF'
27+
cd /home/shlacker2020/Batcave/CPT_ANYTHING/api_looter
28+
docker compose down
29+
docker compose up --build -d
30+
docker exec -it api_looter_web python -m app.seed
31+
EOF

Procfile

Lines changed: 0 additions & 1 deletion
This file was deleted.

docker-compose.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,13 @@ services:
2727
volumes:
2828
- .:/app
2929

30+
watchtower:
31+
image: containrrr/watchtower
32+
container_name: watchtower
33+
restart: always
34+
volumes:
35+
- /var/run/docker.sock:/var/run/docker.sock
36+
command: --cleanup --schedule "0 0 * * *"
37+
3038
volumes:
3139
pgdata:

0 commit comments

Comments
 (0)