FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Allow parallel branch builds · JasonYangCode/docker-python@eb7c4fa · GitHub

Commit eb7c4fa

Browse files
committed
Allow parallel branch builds
1 parent 7780a6f commit eb7c4fa

4 files changed

Lines changed: 28 additions & 10 deletions

File tree

‎Dockerfile‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
ARG BASE_TAG=5.2.0
2+
13
FROM gcr.io/kaggle-images/python-tensorflow-whl:1.12.0-py36 as tensorflow_whl
2-
FROM continuumio/anaconda3:5.2.0
4+
FROM continuumio/anaconda3:${BASE_TAG}
35

46
ADD clean-layer.sh /tmp/clean-layer.sh
57
ADD patches/nbconvert-extensions.tpl /opt/kaggle/nbconvert-extensions.tpl

‎Jenkinsfile‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ pipeline {
1515
GIT_COMMIT_AUTHOR = sh(returnStdout: true, script:"git log --format='%an' -n 1 HEAD").trim()
1616
GIT_COMMIT_SUMMARY = "`<https://github.com/Kaggle/docker-python/commit/${GIT_COMMIT}|${GIT_COMMIT_SHORT}>` ${GIT_COMMIT_SUBJECT} - ${GIT_COMMIT_AUTHOR}"
1717
SLACK_CHANNEL = sh(returnStdout: true, script: "if [[ \"${GIT_BRANCH}\" == \"master\" ]]; then echo \"#kernelops\"; else echo \"#builds\"; fi").trim()
18+
PRETEST_TAG = sh(returnStdout: true, script: "if [[ \"${GIT_BRANCH}\" == \"master\" ]]; then echo \"ci-pretest\"; else echo \"ci-${GIT_BRANCH}-pretest\"; fi").trim()
19+
STAGING_TAG = sh(returnStdout: true, script: "if [[ \"${GIT_BRANCH}\" == \"master\" ]]; then echo \"staging\"; else echo \"${GIT_BRANCH}-staging\"; fi").trim()
1820
}
1921

2022
stages {
@@ -34,7 +36,7 @@ pipeline {
3436
set -exo pipefail
3537
3638
date
37-
./push ci-pretest
39+
./push ${PRETEST_TAG}
3840
'''
3941
}
4042
}
@@ -56,7 +58,7 @@ pipeline {
5658
set -exo pipefail
5759
5860
date
59-
./push staging
61+
./push ${STAGING_TAG}
6062
'''
6163
}
6264
}
@@ -73,7 +75,7 @@ pipeline {
7375
sh '''#!/bin/bash
7476
set -exo pipefail
7577
docker image prune -f # remove previously built image to prevent disk from filling up
76-
./build --gpu | ts
78+
./build --gpu --base-image-tag ${STAGING_TAG} | ts
7779
'''
7880
}
7981
}
@@ -85,7 +87,7 @@ pipeline {
8587
set -exo pipefail
8688
8789
date
88-
./push --gpu ci-pretest
90+
./push --gpu ${PRETEST_TAG}
8991
'''
9092
}
9193
}
@@ -109,7 +111,7 @@ pipeline {
109111
set -exo pipefail
110112
111113
date
112-
./push --gpu staging
114+
./push --gpu ${STAGING_TAG}
113115
'''
114116
}
115117
}

‎build‎

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,16 @@ Usage: $0 [OPTIONS]
77
Build a new Python Docker image.
88
99
Options:
10-
-g, --gpu Build an image with GPU support.
11-
-c, --use-cache Use layer cache when building a new image.
10+
-g, --gpu Build an image with GPU support.
11+
-c, --use-cache Use layer cache when building a new image.
12+
-b, --base-image-tag TAG Base image tag. Defaults to value defined in DOCKERFILE.
1213
EOF
1314
}
1415

1516
CACHE_FLAG='--no-cache'
1617
DOCKERFILE='Dockerfile'
1718
IMAGE_TAG='kaggle/python-build'
19+
BUILD_ARGS=''
1820

1921
while :; do
2022
case "$1" in
@@ -29,6 +31,15 @@ while :; do
2931
-c|--use-cache)
3032
CACHE_FLAG=''
3133
;;
34+
-b|--base-image-tag)
35+
if [[ -z $2 ]]; then
36+
usage
37+
printf 'ERROR: No TAG specified after the %s flag.\n' "$1" >&2
38+
exit
39+
fi
40+
BUILD_ARGS="--build-arg BASE_TAG=$2"
41+
shift # skip the flag value
42+
;;
3243
-?*)
3344
usage
3445
printf 'ERROR: Unknown option: %s\n' "$1" >&2
@@ -44,6 +55,7 @@ done
4455
readonly CACHE_FLAG
4556
readonly DOCKERFILE
4657
readonly IMAGE_TAG
58+
readonly BUILD_ARGS
4759

4860
set -x
49-
docker build --rm --pull $CACHE_FLAG -t "$IMAGE_TAG" -f "$DOCKERFILE" .
61+
docker build --rm --pull $CACHE_FLAG -t "$IMAGE_TAG" -f "$DOCKERFILE" $BUILD_ARGS .

‎gpu.Dockerfile‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
ARG BASE_TAG=staging
2+
13
FROM nvidia/cuda:9.2-cudnn7-devel-ubuntu16.04 AS nvidia
24
FROM gcr.io/kaggle-images/python-tensorflow-whl:1.12.0-py36 as tensorflow_whl
3-
FROM gcr.io/kaggle-images/python:staging
5+
FROM gcr.io/kaggle-images/python:${BASE_TAG}
46

57
ADD clean-layer.sh /tmp/clean-layer.sh
68

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL