add drone.yml

This commit is contained in:
Anang Yusman 2026-02-18 14:52:18 +08:00
parent 9ba7172d45
commit b1506c5d6f
1 changed files with 61 additions and 0 deletions

61
.drone.yml Normal file
View File

@ -0,0 +1,61 @@
kind: pipeline
type: ssh
name: arah-negeri-build-deploy
server:
host:
from_secret: ssh_host
user:
from_secret: ssh_user
ssh_key:
from_secret: ssh_key
steps:
- name: prepare repo
when:
branch:
- dev-1
- main
commands:
- rm -rf /opt/build/arah-negeri
- mkdir -p /opt/build
- cd /opt/build
- git clone http://38.47.180.165:3000/medol/web-arah-negeri.git
- name: build app
when:
branch:
- dev-1
- main
commands:
- cd /opt/build/arah-negeri
- git checkout $DRONE_BRANCH
- git pull
- npm install
- npm run build
- name: build image
when:
branch:
- dev-1
- main
commands:
- docker login 38.47.180.165:3000 -u administrator -p HarborDockerImageRep0
- cd /opt/build/arah-negeri
- docker compose build
- docker push 38.47.180.165:3000/medol/web-arah-negeri.git:$DRONE_BRANCH
- name: deploy
when:
branch:
- main
commands:
- docker pull 38.47.180.165:3000/medol/web-arah-negeri.git:$DRONE_BRANCH
- docker stop arah-negeri || true
- docker rm arah-negeri || true
- docker run -d \
-p 4242:3000 \
--name arah-negeri \
--network=apps_network \
--restart=always \
38.47.180.165:3000/mediahub/arah-negeri:$DRONE_BRANCH