From 26c0cf6c286f5e96045de22e5472179fa69dfd73 Mon Sep 17 00:00:00 2001 From: Flook Date: Fri, 31 Jan 2025 10:10:20 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B8=97=E0=B8=94=E0=B8=AA=E0=B8=AD=E0=B8=9A?= =?UTF-8?q?=20CI/CD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .dockerignore | 3 ++- .drone.yml | 35 +++++++++++++++++++++++++++++++---- src/App.jsx | 2 +- 3 files changed, 34 insertions(+), 6 deletions(-) diff --git a/.dockerignore b/.dockerignore index f2e3d31..bf77ef1 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,3 +1,4 @@ node_modules dist -.git \ No newline at end of file +.git +.env \ No newline at end of file diff --git a/.drone.yml b/.drone.yml index 265dced..9386c2f 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,9 +1,36 @@ kind: pipeline type: docker -name: test-pipeline +name: default steps: - - name: say-hello - image: alpine + - name: Install dependencies + image: node:18-alpine commands: - - echo "Hello from Drone CI!" \ No newline at end of file + - npm ci + + - name: Build + image: node:18-alpine + commands: + - npm run build + + - name: Build Docker Image + image: docker:latest + environment: + DOCKER_USERNAME: + from_secret: DOCKER_USERNAME + DOCKER_PASSWORD: + from_secret: DOCKER_PASSWORD + commands: + - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin + - docker build -t adminsoftwarecraft/opengis:latest . + - docker push adminsoftwarecraft/opengis:latest + + - name: Deploy to Server + image: curlimages/curl:latest + environment: + WEBHOOK_URL: + from_secret: WEBHOOK_URL + WEBHOOK_SECRET: + from_secret: WEBHOOK_SECRET + commands: + - 'curl -X POST "$WEBHOOK_URL" -H "Authorization: Bearer $WEBHOOK_SECRET"' diff --git a/src/App.jsx b/src/App.jsx index a6af01f..8726f20 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -2,7 +2,7 @@ function App() { return (
-

สวัสดี! การ Deploy อัตโนมัติสำเร็จ

+

สวัสดี! CI/CD อัตโนมัติสำเร็จ

) }