Commit 590de714 authored by jnaud's avatar jnaud
Browse files

Update cicd build without docker save

parent 629a6ac9
......@@ -17,12 +17,12 @@ docker build -t ${PROJECT_NAME}_web:${COMMIT} -f $ROOTDIR/cicd/build/docker-prod
# Tag to latest
docker tag ${PROJECT_NAME}_web:${COMMIT} ${PROJECT_NAME}_web
# Remove previous docker if exist
mkdir -p $ROOTDIR/jenkins_release
files=`find $ROOTDIR/jenkins_release -type f -name "*.docker" -print`
if [ "${files}" ]; then
rm $ROOTDIR/jenkins_release/*.docker
fi
## Remove previous docker if exist
#mkdir -p $ROOTDIR/jenkins_release
#files=`find $ROOTDIR/jenkins_release -type f -name "*.docker" -print`
#if [ "${files}" ]; then
# rm $ROOTDIR/jenkins_release/*.docker
#fi
# Save image
docker save ${PROJECT_NAME}_web:${COMMIT} | gzip > $ROOTDIR/jenkins_release/${PROJECT_NAME}_web_${COMMIT}_${DATE}.docker
## Save image
#docker save ${PROJECT_NAME}_web:${COMMIT} | gzip > $ROOTDIR/jenkins_release/${PROJECT_NAME}_web_${COMMIT}_${DATE}.docker
......@@ -25,19 +25,24 @@ echo " Start 99_clean.sh"
echo -n "LOCAL_USER_ID=$(id -u)\nLOCAL_GROUP_ID=$(id -g)" > $SCRIPTDIR/docker-build/docker-compose.env;
if [ "$(docker ps -aq -f name=${DOCKER_NAME}_build_web)" ]; then
echo " Clean container docker build"
docker-compose -f $SCRIPTDIR/docker-build/docker-compose.yml down
fi
# Clean container gerenated
list="${DOCKER_NAME}_web ${DOCKER_NAME}_build_web "
for var in $list
do
if [ "$(docker ps -aq -f name=${var})" ]; then
echo " Clean container ${var}"
docker rm -f ${var}
fi
if [ "$(docker ps -aq -f name=${DOCKER_NAME}_web)" ]; then
echo " Clean container docker prod"
docker rm -f ${DOCKER_NAME}_web
fi
if [ "$(docker images -q -f reference=${DOCKER_NAME}_build_web)" ]; then
echo " Clean images docker build"
docker rmi -f $(docker images -q -f reference=${DOCKER_NAME}_build_web | tail -n 1)
fi
done
# Clean image gerenated
list="${DOCKER_NAME}_build_web"
for var in $list
do
if [ "$(docker images -q -f reference=${var})" ]; then
echo " Clean images ${var}"
docker rmi ${var}
fi
done
echo " End 99_clean.sh"
......@@ -40,7 +40,7 @@ pipeline {
steps {
unstash 'jenkins_release'
sh 'cicd/build/6_make_docker.sh'
stash includes: 'jenkins_release/', name: 'jenkins_release'
//stash includes: 'jenkins_release/', name: 'jenkins_release'
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment