Skip to content

Commit

Permalink
feat(docker): publish image as soon as ready
Browse files Browse the repository at this point in the history
  • Loading branch information
sileht committed Oct 7, 2020
1 parent 5f7013d commit 957e07c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
10 changes: 8 additions & 2 deletions ci/Jenkinsfile.docker
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,21 @@ pipeline {
cron('H 22 * * 1-5')
}
stages {
stage('Building docker images') {
stage('Init') {
steps {
script {
def common = load("ci/Jenkinsfile.common");
common.cancelPreviousBuilds();
}
sh 'tools/build-docker-images.sh'
}
}
stage('Building docker images') {
parallel {
stage('cpu') { steps { sh 'tools/build-docker-images.sh cpu' } }
stage('gpu') { steps { sh 'tools/build-docker-images.sh gpu' } }
stage('gpu_tf') { steps { sh 'tools/build-docker-images.sh gpu_tf' } }
stage('gpu_tensort') { steps { sh 'tools/build-docker-images.sh gpu_tensorrt' } }
}
}
post {
always {
Expand Down
26 changes: 12 additions & 14 deletions tools/build-docker-images.sh
Original file line number Diff line number Diff line change
@@ -1,34 +1,33 @@
#!/bin/bash

export DOCKER_BUILDKIT=1

set -e
set -x

export DOCKER_BUILDKIT=1
[ "${JENKINS_URL}" ] && set -x

selected=$1
if [ ! "$@" ]; then
echo "usage: $(basename $0) [cpu|gpu|...]"
exit 1
fi
NAMES="$@"

declare -A TARGETS
TARGETS[cpu]="cpu/default"
TARGETS[gpu]="gpu/default"
TARGETS[gpu_tf]="gpu/tf"
TARGETS[gpu_tensorrt]="gpu_tensorrt/tensorrt"

NAMES=${!TARGETS[@]}
if [ "$1" ]; then
NAMES="$1"
fi

if [ "$TAG_NAME" ]; then
TMP_TAG="ci-$TAG_NAME"
elif [ "$GIT_BRANCH" == "master" ]; then
TMP_TAG="ci-$GIT_BRANCH"
else
# Not built with Jenkins
TMP_TAG="trash"
fi

image_url_prefix_release="jolibrain/deepdetect"
image_url_prefix_ci="ceres:5000/${image_url_prefix_release}"
images_to_push=
image_url_prefix="jolibrain/deepdetect"

for name in $NAMES; do
target=${TARGETS[$name]}
Expand All @@ -39,11 +38,10 @@ for name in $NAMES; do

arch=${target%%/*}
build=${target##*/}
image_url_release="${image_url_prefix_release}_${name}"
image_url_ci="${image_url_prefix_ci}_${name}"
image_url="${image_url_prefix}_${name}"

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

0 comments on commit 957e07c

Please sign in to comment.