feat: 添加 Jenkins 部署配置
- Jenkinsfile: GenericTrigger webhook 触发,构建镜像并部署 - docker-compose.yml: nginx 外部网络,shm_size 1g - 宿主机端口映射 3010:3000
This commit is contained in:
Vendored
+59
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user