Skip to content

Commit 957e07c

Browse files
committed
feat(docker): publish image as soon as ready
1 parent 5f7013d commit 957e07c

File tree

2 files changed

+20
-16
lines changed

2 files changed

+20
-16
lines changed

ci/Jenkinsfile.docker

+8-2
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,21 @@ pipeline {
44
cron('H 22 * * 1-5')
55
}
66
stages {
7-
stage('Building docker images') {
7+
stage('Init') {
88
steps {
99
script {
1010
def common = load("ci/Jenkinsfile.common");
1111
common.cancelPreviousBuilds();
1212
}
13-
sh 'tools/build-docker-images.sh'
1413
}
1514
}
15+
stage('Building docker images') {
16+
parallel {
17+
stage('cpu') { steps { sh 'tools/build-docker-images.sh cpu' } }
18+
stage('gpu') { steps { sh 'tools/build-docker-images.sh gpu' } }
19+
stage('gpu_tf') { steps { sh 'tools/build-docker-images.sh gpu_tf' } }
20+
stage('gpu_tensort') { steps { sh 'tools/build-docker-images.sh gpu_tensorrt' } }
21+
}
1622
}
1723
post {
1824
always {

tools/build-docker-images.sh

+12-14
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,33 @@
11
#!/bin/bash
22

3+
export DOCKER_BUILDKIT=1
4+
35
set -e
4-
set -x
56

6-
export DOCKER_BUILDKIT=1
7+
[ "${JENKINS_URL}" ] && set -x
78

8-
selected=$1
9+
if [ ! "$@" ]; then
10+
echo "usage: $(basename $0) [cpu|gpu|...]"
11+
exit 1
12+
fi
13+
NAMES="$@"
914

1015
declare -A TARGETS
1116
TARGETS[cpu]="cpu/default"
1217
TARGETS[gpu]="gpu/default"
1318
TARGETS[gpu_tf]="gpu/tf"
1419
TARGETS[gpu_tensorrt]="gpu_tensorrt/tensorrt"
1520

16-
NAMES=${!TARGETS[@]}
17-
if [ "$1" ]; then
18-
NAMES="$1"
19-
fi
20-
2121
if [ "$TAG_NAME" ]; then
2222
TMP_TAG="ci-$TAG_NAME"
2323
elif [ "$GIT_BRANCH" == "master" ]; then
2424
TMP_TAG="ci-$GIT_BRANCH"
2525
else
26+
# Not built with Jenkins
2627
TMP_TAG="trash"
2728
fi
2829

29-
image_url_prefix_release="jolibrain/deepdetect"
30-
image_url_prefix_ci="ceres:5000/${image_url_prefix_release}"
31-
images_to_push=
30+
image_url_prefix="jolibrain/deepdetect"
3231

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

4039
arch=${target%%/*}
4140
build=${target##*/}
42-
image_url_release="${image_url_prefix_release}_${name}"
43-
image_url_ci="${image_url_prefix_ci}_${name}"
41+
image_url="${image_url_prefix}_${name}"
4442

4543
docker build \
46-
-t $image_url_ci:$TMP_TAG \
44+
-t $image_url:$TMP_TAG \
4745
--build-arg DEEPDETECT_BUILD=$build \
4846
-f docker/${arch}.Dockerfile \
4947
.

0 commit comments

Comments
 (0)