diff --git a/Jenkinsfile b/Jenkinsfile index 7a46844b..0f2b89d7 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -44,7 +44,7 @@ pipeline { sh """ cd ./jenkins/${ENV:GIT_BRANCH} docker-compose stop | true - docker-compose up -d --scale worker=3 + docker-compose up -d """ } } @@ -52,8 +52,10 @@ pipeline { steps { echo 'Cleanup...' sh """ - docker rmi `docker images | grep '' | grep -v IMAGE | awk '{ print \$3 }' | xargs` | true - docker rm `docker ps -a | grep Exited | awk '{ print \$1 }' | xargs` | true + # remove unused containers + + # remove unused images + """ } } diff --git a/docker_init.sh b/docker_init.sh index d4f2ee9a..4d571769 100755 --- a/docker_init.sh +++ b/docker_init.sh @@ -6,10 +6,19 @@ then : else jspath=`ls /app/dist/js/app.*.js` - cp ${jspath} ${jspath}.bak sed -i "s?localhost:8000?${CRAWLAB_API_ADDRESS}?g" ${jspath} fi +# replace base url +if [ "${CRAWLAB_BASE_URL}" = "" ]; +then + : +else + indexpath=/app/dist/index.html + sed -i "s?/js/?${CRAWLAB_BASE_URL}/js/?g" ${indexpath} + sed -i "s?/css/?${CRAWLAB_BASE_URL}/css/?g" ${indexpath} +fi + # start nginx service nginx start diff --git a/jenkins/develop/docker-compose.yaml b/jenkins/develop/docker-compose.yaml index cf466671..ec95ae9f 100644 --- a/jenkins/develop/docker-compose.yaml +++ b/jenkins/develop/docker-compose.yaml @@ -4,6 +4,7 @@ services: image: "tikazyq/crawlab:develop" environment: CRAWLAB_API_ADDRESS: "crawlab.cn/dev/api" + CRAWLAB_BASE_URL: "/dev" CRAWLAB_SERVER_MASTER: "Y" CRAWLAB_MONGO_HOST: "mongo" CRAWLAB_REDIS_ADDRESS: "redis" diff --git a/jenkins/master/docker-compose.yaml b/jenkins/master/docker-compose.yaml index 0bcaee3a..7309829d 100644 --- a/jenkins/master/docker-compose.yaml +++ b/jenkins/master/docker-compose.yaml @@ -4,6 +4,7 @@ services: image: "tikazyq/crawlab:master" environment: CRAWLAB_API_ADDRESS: "crawlab.cn/api" + CRAWLAB_BASE_URL: "/demo" CRAWLAB_SERVER_MASTER: "Y" CRAWLAB_MONGO_HOST: "mongo" CRAWLAB_REDIS_ADDRESS: "redis"