mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-21 17:21:09 +01:00
updated Jenkinsfile
This commit is contained in:
30
Jenkinsfile
vendored
30
Jenkinsfile
vendored
@@ -6,17 +6,12 @@ pipeline {
|
||||
}
|
||||
|
||||
environment {
|
||||
HOME = '/home/yeqing'
|
||||
NODE_HOME = '/home/yeqing/.nvm/versions/node/v8.12.0'
|
||||
ROOT_DIR = "/home/yeqing/jenkins_home/workspace/crawlab_${GIT_BRANCH}"
|
||||
PYTHON_HOME = '/home/yeqing/.pyenv/shims'
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('Setup') {
|
||||
steps {
|
||||
echo "Running Setup..."
|
||||
// sh '. /home/yeqing/.profile'
|
||||
script {
|
||||
if (env.GIT_BRANCH == 'develop') {
|
||||
env.MODE = 'test'
|
||||
@@ -28,18 +23,12 @@ pipeline {
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Build Frontend') {
|
||||
stage('Build') {
|
||||
steps {
|
||||
echo "Building frontend..."
|
||||
// sh "${NODE_HOME}/bin/node ${NODE_HOME}/bin/npm install -g yarn pm2 --registry=http://registry.npm.taobao.org/"
|
||||
sh "cd ${ROOT_DIR}/frontend && ${NODE_HOME}/bin/node ${NODE_HOME}/bin/yarn install --registry=http://registry.npm.taobao.org/ --scripts-prepend-node-path=${NODE_HOME}/bin/node"
|
||||
sh "cd ${ROOT_DIR}/frontend && ${NODE_HOME}/bin/node ${ROOT_DIR}/frontend/node_modules/.bin/vue-cli-service build --mode=${MODE}"
|
||||
}
|
||||
}
|
||||
stage('Build Backend') {
|
||||
steps {
|
||||
echo "Building backend..."
|
||||
sh "${PYTHON_HOME}/pip install -r ${ROOT_DIR}/crawlab/requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple"
|
||||
echo "Building..."
|
||||
sh """
|
||||
docker build -t crawlab:latest .
|
||||
"""
|
||||
}
|
||||
}
|
||||
stage('Test') {
|
||||
@@ -50,7 +39,14 @@ pipeline {
|
||||
stage('Deploy') {
|
||||
steps {
|
||||
echo 'Deploying....'
|
||||
sh "${NODE_HOME}/bin/node ${NODE_HOME}/bin/pm2 reload all"
|
||||
sh """
|
||||
docker stop crawlab | true
|
||||
docker run -d --rm --restart always --name crawlab \
|
||||
-p 8080:8080 \
|
||||
-p 8000:8000 \
|
||||
-v /home/yeqing/.env.production:/opt/crawlab/frontend/.env.production \
|
||||
-v /home/yeqing/config.py:/opt/crawlab/crawlab/config/config.py
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user