Skip to content

Commit

Permalink
build: allow to build any target with jenkins
Browse files Browse the repository at this point in the history
  • Loading branch information
sileht committed Oct 5, 2020
1 parent a5700e0 commit 01f8646
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 21 deletions.
30 changes: 9 additions & 21 deletions ci/Jenkinsfile.docker
Expand Up @@ -13,28 +13,16 @@ pipeline {
}
}
stage('Building docker images') {
parallel {
stage('Building docker cpu image') {
steps {
sh '''
docker build -t ceres:5000/jolibrain/deepdetect_cpu:ci -f docker/cpu.Dockerfile .
docker push ceres:5000/jolibrain/deepdetect_cpu:ci
'''
}
}
stage('Building docker gpu image') {
steps {
sh '''
docker build -t ceres:5000/jolibrain/deepdetect_gpu:ci -f docker/gpu.Dockerfile .
docker push ceres:5000/jolibrain/deepdetect_gpu:ci
'''
}
steps {
sh '''
tools/build-docker-images.sh
'''
}
}}
}
post {
always {
sh '''
}
}
post {
always {
sh '''
docker images -q -f dangling=true | xargs docker rmi
docker image prune -f
'''
Expand Down
30 changes: 30 additions & 0 deletions tools/build-docker-images.sh
@@ -0,0 +1,30 @@
#!/bin/bash

TARGETS="cpu/default" # gpu/default gpu/tf gpu/tensorrt"

if [ "$GIT_BRANCH" == "master" ]; then
TMP_TAG="ci"
else
TMP_TAG="trash"
fi

image_url_prefix="ceres:5000/jolibrain/deepdetect"
images_to_push=

for target in $TARGETS ; do
arch=${target%%/*}
build=${target##*/}
image_url="${image_url_prefix}_${arch}"
[ "$build" != "default"] && image_url="${image_url}_build"

docker build \
-t $image_url:$TMP_TAG \
--build-arg DEEPDETECT_BUILD=$build \
-f docker/${arch}.Dockerfile

images_to_push="${images_to_push} $image_url:$TMP_TAG"
done

for image in $images_to_push; do
docker push $image
done

0 comments on commit 01f8646

Please sign in to comment.