Skip to content

Commit

Permalink
add github cd
Browse files Browse the repository at this point in the history
  • Loading branch information
Fauzanmhr committed Aug 22, 2024
1 parent 1031fa1 commit b69a55d
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 1 deletion.
44 changes: 44 additions & 0 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Node.js CD

on:
push:
branches: [ "main", "dev" ]

jobs:
build:
runs-on: ubuntu-latest
environment: main
steps:
- name: deploy to vps using ssh
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
port: 22
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
key: ${{ secrets.PRIVATE_KEY }}
script: |
cd ~/.apps/zannime
git pull
git status
sudo docker compose -f docker-compose.yaml build
sudo docker compose -f docker-compose.yaml up -d
dev-build:
runs-on: ubuntu-latest
environment: dev
steps:
- name: deploy to vps using ssh for dev
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
port: 22
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
key: ${{ secrets.PRIVATE_KEY }}
script: |
cd ~/.apps/zannime-dev
git pull
git status
sudo docker compose -f docker-compose-dev.yaml build
sudo docker compose -f docker-compose-dev.yaml up -d
26 changes: 26 additions & 0 deletions docker-compose-dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
services:
zannime-dev:
build:
context: .
dockerfile: dockerfiles/Dockerfile.zannime
container_name: zannime-dev
restart: unless-stopped
ports:
- "3005:3000"
environment:
- NODE_ENV=development
- API_URL=http://wajik-anime-api-dev:3001

wajik-anime-api-dev:
build:
context: wajik-anime-api
dockerfile: ../dockerfiles/Dockerfile.wajik-anime-api
container_name: wajik-anime-api-dev
restart: unless-stopped
expose:
- 3001
environment:
- NODE_ENV=production

networks:
zannime-dev:
2 changes: 1 addition & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ services:
container_name: zannime
restart: unless-stopped
ports:
- 3000:3000
- "3000:3000"
environment:
- NODE_ENV=production
depends_on:
Expand Down

0 comments on commit b69a55d

Please sign in to comment.