11version : 2.1
22
33orbs :
4- docker : circleci/docker@2.2.0
4+ docker : circleci/docker@2.8
55
6+
7+ commands :
8+ split_python_version :
9+ steps :
10+ - run :
11+ name : Split python version
12+ command : |
13+ echo "export PYTHON_VERSION=$(echo $PYTHON_VERSION_PATCH | cut -d'.' -f1,2)" >> $BASH_ENV
14+ source $BASH_ENV
15+ setup_buildkit_builder :
16+ steps :
17+ - run :
18+ name : Setup BuildKit builder
19+ command : |
20+ docker buildx create \
21+ --name custom-builder \
22+ --use \
23+ --driver docker-container \
624jobs :
25+ build-and-push-base :
26+ executor : docker/docker
27+ steps :
28+ - checkout
29+ - setup_remote_docker
30+ - setup_buildkit_builder
31+ - docker/check :
32+ use-docker-credentials-store : true
33+ - docker/build :
34+ step-name : Base python image (debian + apt-get deps)
35+ path : ./python/base
36+ dockerfile : Dockerfile.base
37+ extra_build_args : |
38+ --progress plain
39+ --platform linux/amd64
40+ --cache-from type=registry,ref=deepnote/python:base-buildcache,mode=max
41+ --cache-to type=registry,ref=deepnote/python:base-buildcache,mode=max
42+ --output type=registry,push=true
43+ image : deepnote/python
44+ tag : base${CIRCLE_PULL_REQUEST:+-ra-${CIRCLE_PULL_REQUEST##*/}}
745 build-and-push-python :
846 executor : docker/docker
947 parameters :
1048 python-version :
1149 type : string
1250 environment :
13- PYTHON_VERSION : << parameters.python-version >>
51+ PYTHON_VERSION_PATCH : << parameters.python-version >>
1452 steps :
1553 - checkout
1654 - setup_remote_docker
1755 - docker/check :
1856 use-docker-credentials-store : true
57+ - split_python_version
58+ - setup_buildkit_builder
1959 - docker/build :
20- step-name : Base Python image
60+ step-name : Python image
2161 path : ./python/base
22- dockerfile : Dockerfile
23- extra_build_args : " --build-arg FROM_PYTHON_VERSION=${PYTHON_VERSION}"
24- image : deepnote/python
25- tag : ${PYTHON_VERSION}${CIRCLE_PULL_REQUEST:+-ra-${CIRCLE_PULL_REQUEST##*/}}
26- - docker/push :
62+ dockerfile : Dockerfile.python
63+ extra_build_args : |
64+ --build-arg CIRCLE_PULL_REQUEST=${CIRCLE_PULL_REQUEST}
65+ --build-arg PYTHON_VERSION=${PYTHON_VERSION}
66+ --build-arg PYTHON_VERSION_PATCH=${PYTHON_VERSION_PATCH}
67+ --progress plain
68+ --platform linux/amd64
69+ --cache-from type=registry,ref=deepnote/python:${PYTHON_VERSION}-buildcache,mode=max
70+ --cache-to type=registry,ref=deepnote/python:${PYTHON_VERSION}-buildcache,mode=max
71+ --output type=registry,push=true
2772 image : deepnote/python
2873 tag : ${PYTHON_VERSION}${CIRCLE_PULL_REQUEST:+-ra-${CIRCLE_PULL_REQUEST##*/}}
2974 build-and-push-python-datascience :
@@ -32,24 +77,30 @@ jobs:
3277 python-version :
3378 type : string
3479 environment :
35- PYTHON_VERSION : << parameters.python-version >>
80+ PYTHON_VERSION_PATCH : << parameters.python-version >>
3681 steps :
3782 - checkout
3883 - setup_remote_docker
3984 - docker/check :
4085 use-docker-credentials-store : true
86+ - split_python_version
87+ - setup_buildkit_builder
4188 - docker/build :
4289 step-name : Datascience Python image
4390 path : ./python/datascience
4491 docker-context : ./python/datascience
4592 dockerfile : Dockerfile.datascience
46- extra_build_args : " --build-arg FROM_PYTHON_VERSION=${PYTHON_VERSION}"
93+ extra_build_args : |
94+ --build-arg PYTHON_VERSION=${PYTHON_VERSION}
95+ --build-arg CIRCLE_PULL_REQUEST=${CIRCLE_PULL_REQUEST}
96+ --progress plain
97+ --platform linux/amd64
98+ --cache-from type=registry,ref=deepnote/python:${PYTHON_VERSION}-buildcache,mode=max
99+ --cache-from type=registry,ref=deepnote/python-datascience:${PYTHON_VERSION}-buildcache,mode=max
100+ --cache-to type=registry,ref=deepnote/python-datascience:${PYTHON_VERSION}-buildcache,mode=max
101+ --output type=registry,push=true
47102 image : deepnote/python-datascience
48103 tag : ${PYTHON_VERSION}${CIRCLE_PULL_REQUEST:+-ra-${CIRCLE_PULL_REQUEST##*/}}
49- - docker/push :
50- image : deepnote/python-datascience
51- tag : ${PYTHON_VERSION}${CIRCLE_PULL_REQUEST:+-ra-${CIRCLE_PULL_REQUEST##*/}}
52-
53104 build-and-push-gpu :
54105 executor : docker/docker
55106 parameters :
@@ -68,44 +119,42 @@ jobs:
68119 - setup_remote_docker
69120 - docker/check :
70121 use-docker-credentials-store : true
122+ - split_python_version
71123 - docker/build :
72124 step-name : Tensorflow GPU image
73125 path : ./gpu
74- extra_build_args : " --build-arg CUDA_IMAGE_TAG=${CUDA_TAG} --build-arg TF_VERSION=${TF_VERSION} --build-arg PYTHON_VER=${PY_VERSION}"
126+ extra_build_args : " --build-arg CUDA_IMAGE_TAG=${CUDA_TAG} --build-arg TF_VERSION=${TF_VERSION} --build-arg PYTHON_VER=${PY_VERSION} --progress plain "
75127 image : deepnote/tensorflow
76128 tag : ${TF_VERSION}${CIRCLE_PULL_REQUEST:+-ra-${CIRCLE_PULL_REQUEST##*/}}-gpu
77129 - docker/push :
78130 image : deepnote/tensorflow
79131 tag : ${TF_VERSION}${CIRCLE_PULL_REQUEST:+-ra-${CIRCLE_PULL_REQUEST##*/}}-gpu
80132
133+ python-versions : &python-versions
134+ - " 3.8.19"
135+ - " 3.9.19"
136+ - " 3.10.15"
137+ - " 3.11.10"
138+
81139workflows :
82140 build :
83141 jobs :
142+ - build-and-push-base :
143+ name : Building the base image
84144 - build-and-push-python :
85- name : Python 3.8
86- python-version : " 3.8"
87- - build-and-push-python :
88- name : Python 3.9
89- python-version : " 3.9"
90- - build-and-push-python :
91- name : Python 3.10
92- python-version : " 3.10"
93- - build-and-push-python :
94- name : Python 3.11
95- python-version : " 3.11"
96-
97- - build-and-push-python-datascience :
98- name : Python Datascience 3.8
99- python-version : " 3.8"
145+ name : Python << matrix.python-version >>
146+ matrix :
147+ parameters :
148+ python-version : *python-versions
149+ requires :
150+ - Building the base image
100151 - build-and-push-python-datascience :
101- name : Python Datascience 3.9
102- python-version : " 3.9"
103- - build-and-push-python-datascience :
104- name : Python Datascience 3.10
105- python-version : " 3.10"
106- - build-and-push-python-datascience :
107- name : Python Datascience 3.11
108- python-version : " 3.11"
152+ name : Python Datascience << matrix.python-version >>
153+ matrix :
154+ parameters :
155+ python-version : *python-versions
156+ requires :
157+ - Python << matrix.python-version >>
109158
110159 - build-and-push-gpu :
111160 name : Tensorflow 2.9
0 commit comments