From a6c36442b29aeaa80b5af39490a34f33aa3b35a3 Mon Sep 17 00:00:00 2001 From: kurihada Date: Sat, 28 Feb 2026 23:11:47 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=20Jenkins=20?= =?UTF-8?q?=E9=83=A8=E7=BD=B2=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Jenkinsfile: GenericTrigger webhook 触发,构建镜像并部署 - docker-compose.yml: nginx 外部网络,shm_size 1g - 宿主机端口映射 3010:3000 --- Jenkinsfile | 59 ++++++++++++++++++++++++++++++++++++++++++++++ docker-compose.yml | 24 +++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 Jenkinsfile create mode 100644 docker-compose.yml diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..f8dfd11 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,59 @@ +pipeline { + agent any + + environment { + APP_NAME = 'social-mcp' + } + + triggers { + GenericTrigger(token: 'social-mcp-deploy') + } + + stages { + stage('Checkout') { + steps { + checkout scm + } + } + + stage('Build Docker Image') { + steps { + sh "docker build -t ${APP_NAME}:${BUILD_NUMBER} -t ${APP_NAME}:latest ." + } + } + + stage('Deploy') { + steps { + sh """ + docker stop ${APP_NAME} || true + docker rm ${APP_NAME} || true + mkdir -p /data/${APP_NAME} + chown 1001:1001 /data/${APP_NAME} + docker run -d \ + --name ${APP_NAME} \ + --network nginx \ + -p 3010:3000 \ + --shm-size=1g \ + -v /data/${APP_NAME}:/home/appuser/.social-mcp \ + -e NODE_ENV=production \ + -e HOST=0.0.0.0 \ + -e PORT=3000 \ + -e HEADLESS=true \ + -e COOKIE_DIR=/home/appuser/.social-mcp \ + -e ALLOW_REMOTE=yes-i-understand-the-risk \ + --restart unless-stopped \ + ${APP_NAME}:latest + """ + } + } + } + + post { + success { + echo "Deployed ${APP_NAME} build #${BUILD_NUMBER} successfully" + } + failure { + echo "Build #${BUILD_NUMBER} failed" + } + } +} diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..9d18172 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,24 @@ +services: + app: + build: . + image: social-mcp:latest + container_name: social-mcp + ports: + - "3010:3000" + shm_size: '1gb' + volumes: + - /data/social-mcp:/home/appuser/.social-mcp + environment: + - NODE_ENV=production + - HOST=0.0.0.0 + - PORT=3000 + - HEADLESS=true + - COOKIE_DIR=/home/appuser/.social-mcp + - ALLOW_REMOTE=yes-i-understand-the-risk + restart: unless-stopped + networks: + - nginx + +networks: + nginx: + external: true