mirror of
https://gitee.com/kennylee/docker.git
synced 2024-11-29 18:38:34 +08:00
解决ci-webhook的无法正常删除的bug
This commit is contained in:
parent
12082105f6
commit
7ee31547a0
@ -1,16 +1,16 @@
|
||||
FROM registry.cn-hangzhou.aliyuncs.com/kennylee/sshd-tomcat:tomcat8-jdk7-nodejs7
|
||||
|
||||
ENV REPO_URL=http://sys:11111111@192.168.3.231:10080/zgbj/gkxt.git
|
||||
ENV PROJECT_NAME=gkxt
|
||||
ENV LOCAL_REPO_PATH=/var/source/
|
||||
|
||||
RUN sed -i "s@\/usr\/lib\/jvm\/java-7-oracle@${JAVA_HOME}@" /etc/init.d/tomcat
|
||||
RUN sed -i "s@-server -Xms128m -Xmx1024m -XX\:PermSize=64M -XX\:MaxPermSize=192M@${JAVA_OPTS}@" /etc/init.d/tomcat
|
||||
|
||||
VOLUME $HOME/.gradle/
|
||||
VOLUME $LOCAL_REPO_PATH
|
||||
VOLUME /opt/tomcat/webapps/
|
||||
|
||||
RUN cd /root && git clone https://git.oschina.net/kennylee/ci-webhook.git ci-webhook
|
||||
RUN cd ci-webhook && cnpm install
|
||||
RUN cd /tmp/ && git clone $REPO_URL $PROJECT_NAME
|
||||
|
||||
COPY deploy.sh /deploy.sh
|
||||
RUN chmod +x /deploy.sh
|
||||
|
@ -1,9 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
PROJECT_NAME=gkxt
|
||||
REPO_BRANCH=feature_testci
|
||||
PROJECT_NAME="${PROJECT_NAME:=gkxt}"
|
||||
REPO_BRANCH="${REPO_BRANCH:=master}"
|
||||
CUSTOM_JAVA_OPTS=
|
||||
BUILD_COMMAND="./gradlew --no-daemon clean dist -x test"
|
||||
BUILD_COMMAND="${BUILD_COMMAND:=./gradlew --no-daemon clean dist -x test}"
|
||||
LOCAL_REPO_PATH="${LOCAL_REPO_PATH:=/var/source/}"
|
||||
REPO_URL="${REPO_URL:=}"
|
||||
|
||||
if [ -n "${JAVA_OPTS}" ]; then
|
||||
CUSTOM_JAVA_OPTS="$JAVA_OPTS"
|
||||
@ -16,12 +18,28 @@ if [ -n "${CUSTOM_JAVA_OPTS}" ]; then
|
||||
export JAVA_OPTS=$CUSTOM_JAVA_OPTS
|
||||
fi
|
||||
|
||||
${CATALINA_HOME}/bin/catalina.sh stop
|
||||
sleep 3s
|
||||
cd /tmp/$PROJECT_NAME
|
||||
git checkout $REPO_BRANCH
|
||||
git fetch origin $REPO_BRANCH
|
||||
git reset --hard origin/$REPO_BRANCH
|
||||
$BUILD_COMMAND
|
||||
/bin/bash -c "rm -rf ${TOMCAT_WEBAPPS_PATH}* && unzip /tmp/$PROJECT_NAME/build/dist/*.zip -d $TOMCAT_WEBAPPS_PATH && ${CATALINA_HOME}/bin/catalina.sh run"
|
||||
function fetch_repo(){
|
||||
cd $LOCAL_REPO_PATH$PROJECT_NAME
|
||||
git checkout $REPO_BRANCH
|
||||
git fetch origin $REPO_BRANCH
|
||||
git reset --hard origin/$REPO_BRANCH
|
||||
}
|
||||
|
||||
function clone_repo(){
|
||||
cd $LOCAL_REPO_PATH && git clone $REPO_URL $PROJECT_NAME && cd $PROJECT_NAME
|
||||
git checkout $REPO_BRANCH
|
||||
}
|
||||
|
||||
if [ -n "$REPO_URL" ]; then
|
||||
${CATALINA_HOME}/bin/catalina.sh stop
|
||||
sleep 3s
|
||||
if [ -d $LOCAL_REPO_PATH$PROJECT_NAME ]; then
|
||||
fetch_repo
|
||||
else
|
||||
clone_repo
|
||||
fi
|
||||
$BUILD_COMMAND
|
||||
/bin/bash -c "rm -rf ${TOMCAT_WEBAPPS_PATH}* && unzip -q $LOCAL_REPO_PATH$PROJECT_NAME/build/dist/*.zip -d $TOMCAT_WEBAPPS_PATH"
|
||||
fi
|
||||
${CATALINA_HOME}/bin/catalina.sh run
|
||||
|
||||
|
@ -6,7 +6,7 @@ services:
|
||||
- ./server.js:/root/ci-webhook/server.js:z
|
||||
- ./supervisord.conf:/etc/supervisor/conf.d/supervisord.conf:z
|
||||
- ./data/gradle/:/root/.gradle/
|
||||
- ./data/webapps/:/opt/tomcat/webapps/:z
|
||||
#- ./data/webapps/:/opt/tomcat/webapps/:z
|
||||
ports:
|
||||
- "8080:8080"
|
||||
- "7788:7788"
|
||||
|
@ -9,7 +9,7 @@ command=/bin/bash /deploy.sh
|
||||
stdout_events_enabled = true
|
||||
stderr_events_enabled = true
|
||||
startretries=3
|
||||
environment=JAVA_OPTS='-server -Xms256m -Xmx1536m -XX:PermSize=64M -XX:MaxPermSize=192M'
|
||||
environment=JAVA_OPTS='-server -Xms256m -Xmx1536m -XX:PermSize=64M -XX:MaxPermSize=192M',REPO_BRANCH='master',REPO_URL='http://sys:11111111@192.168.3.231:10080/zgbj/gkxt.git',BUILD_COMMAND='./gradlew --no-daemon clean dist -x test',REPO_BRANCH='master'
|
||||
|
||||
[program:ci]
|
||||
command=/usr/bin/node /root/ci-webhook/server.js
|
||||
@ -18,7 +18,7 @@ stderr_events_enabled = true
|
||||
|
||||
[eventlistener:stdout]
|
||||
command = supervisor_stdout
|
||||
buffer_size = 10
|
||||
#buffer_size = 10
|
||||
events = PROCESS_LOG
|
||||
result_handler = supervisor_stdout:event_handler
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user