11version : 2.1
22
33orbs :
4+ aws-cli : circleci/aws-cli@5.1.1
45 docker : circleci/docker@2.8
56
67
@@ -21,88 +22,146 @@ commands:
2122 --name custom-builder \
2223 --use \
2324 --driver docker-container \
25+ docker_login :
26+ steps :
27+ - aws-cli/setup :
28+ role_arn : arn:aws:iam::978928340082:role/CircleCI
29+ profile_name : production
30+ role_session_name : " circleci-session"
31+ session_duration : " 1800"
32+ - run :
33+ name : Docker and ECR login
34+ command : |
35+ docker login --username $DOCKER_LOGIN --password $DOCKER_PASSWORD
36+ aws ecr get-login-password --region us-east-1 --profile production | \
37+ docker login --username AWS --password-stdin 978928340082.dkr.ecr.us-east-1.amazonaws.com
2438jobs :
2539 build-and-push-base :
26- executor : docker/docker
40+ machine :
41+ image : ubuntu-2404:current
2742 steps :
2843 - checkout
29- - setup_remote_docker
44+ - docker_login
3045 - 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##*/}}
46+ - run :
47+ name : Build and push base image
48+ command : |
49+ docker buildx build \
50+ --file=./python/base/Dockerfile.base \
51+ --tag=978928340082.dkr.ecr.us-east-1.amazonaws.com/deepnote/python:base \
52+ --tag=docker.io/deepnote/python:base \
53+ --cache-from type=registry,ref=docker.io/deepnote/python:base-buildcache,mode=max \
54+ --cache-to type=registry,ref=docker.io/deepnote/python:base-buildcache,mode=max,image-manifest=true,oci-mediatypes=true \
55+ --progress plain \
56+ --platform linux/amd64 \
57+ --provenance=false \
58+ --sbom=false \
59+ --output type=registry,push=true \
60+ .
61+
4562 build-and-push-python :
46- executor : docker/docker
63+ machine :
64+ image : ubuntu-2404:current
4765 parameters :
4866 python-version :
4967 type : string
5068 environment :
5169 PYTHON_VERSION_PATCH : << parameters.python-version >>
5270 steps :
5371 - checkout
54- - setup_remote_docker
55- - docker/check :
56- use-docker-credentials-store : true
57- - split_python_version
72+ - docker_login
73+ - split_python_version # This provides PYTHON_VERSION
5874 - setup_buildkit_builder
59- - docker/build :
60- step-name : Python image
61- path : ./python/base
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
72- image : deepnote/python
73- tag : ${PYTHON_VERSION}${CIRCLE_PULL_REQUEST:+-ra-${CIRCLE_PULL_REQUEST##*/}}
75+ - run :
76+ name : Build and push python image
77+ command : |
78+ REPOSITORY="deepnote/python"
79+ TAG="${PYTHON_VERSION}${CIRCLE_PULL_REQUEST:+-ra-${CIRCLE_PULL_REQUEST##*/}}"
80+ docker buildx build \
81+ --file=./python/python/Dockerfile.python \
82+ --tag=978928340082.dkr.ecr.us-east-1.amazonaws.com/${REPOSITORY}:${TAG} \
83+ --tag=docker.io/${REPOSITORY}:${TAG} \
84+ --build-arg CIRCLE_PULL_REQUEST=${CIRCLE_PULL_REQUEST} \
85+ --build-arg PYTHON_VERSION=${PYTHON_VERSION} \
86+ --build-arg PYTHON_VERSION_PATCH=${PYTHON_VERSION_PATCH} \
87+ --cache-from type=registry,ref=docker.io/${REPOSITORY}:${TAG}-buildcache,mode=max \
88+ --cache-to type=registry,ref=docker.io/${REPOSITORY}:${TAG}-buildcache,mode=max,image-manifest=true,oci-mediatypes=true \
89+ --progress plain \
90+ --platform linux/amd64 \
91+ --provenance=false \
92+ --sbom=false \
93+ --output type=registry,push=true \
94+ .
95+
7496 build-and-push-python-datascience :
75- executor : docker/docker
97+ machine :
98+ image : ubuntu-2404:current
7699 parameters :
77100 python-version :
78101 type : string
79102 environment :
80103 PYTHON_VERSION_PATCH : << parameters.python-version >>
81104 steps :
82105 - checkout
83- - setup_remote_docker
84- - docker/check :
85- use-docker-credentials-store : true
86- - split_python_version
106+ - docker_login
107+ - split_python_version # This provides PYTHON_VERSION
87108 - setup_buildkit_builder
88- - docker/build :
89- step-name : Datascience Python image
90- path : ./python/datascience
91- docker-context : ./python/datascience
92- dockerfile : Dockerfile.datascience
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
102- image : deepnote/python-datascience
103- tag : ${PYTHON_VERSION}${CIRCLE_PULL_REQUEST:+-ra-${CIRCLE_PULL_REQUEST##*/}}
109+ - run :
110+ name : Build and push python-datascience image
111+ command : |
112+ REPOSITORY="deepnote/python"
113+ TAG="${PYTHON_VERSION}-datascience${CIRCLE_PULL_REQUEST:+-ra-${CIRCLE_PULL_REQUEST##*/}}"
114+ docker buildx build \
115+ --file=./python/datascience/Dockerfile.datascience \
116+ --tag=978928340082.dkr.ecr.us-east-1.amazonaws.com/${REPOSITORY}:${TAG} \
117+ --tag=docker.io/${REPOSITORY}:${TAG} \
118+ --build-arg CIRCLE_PULL_REQUEST=${CIRCLE_PULL_REQUEST} \
119+ --build-arg PYTHON_VERSION=${PYTHON_VERSION} \
120+ --cache-from type=registry,ref=docker.io/${REPOSITORY}:${TAG}-buildcache,mode=max \
121+ --cache-to type=registry,ref=docker.io/${REPOSITORY}:${TAG}-buildcache,mode=max,image-manifest=true,oci-mediatypes=true \
122+ --progress plain \
123+ --platform linux/amd64 \
124+ --provenance=false \
125+ --sbom=false \
126+ --output type=registry,push=true \
127+ ./python/datascience
128+
129+ build-and-push-python-conda :
130+ machine :
131+ image : ubuntu-2404:current
132+ parameters :
133+ python-version :
134+ type : string
135+ environment :
136+ PYTHON_VERSION_PATCH : << parameters.python-version >>
137+ steps :
138+ - checkout
139+ - docker_login
140+ - split_python_version # This provides PYTHON_VERSION
141+ - setup_buildkit_builder
142+ - run :
143+ name : Build and push python-conda image
144+ command : |
145+ REPOSITORY="deepnote/python"
146+ TAG="${PYTHON_VERSION}-conda${CIRCLE_PULL_REQUEST:+-ra-${CIRCLE_PULL_REQUEST##*/}}"
147+ docker buildx build \
148+ --file=./python/conda/Dockerfile.conda \
149+ --tag=978928340082.dkr.ecr.us-east-1.amazonaws.com/${REPOSITORY}:${TAG} \
150+ --tag=docker.io/${REPOSITORY}:${TAG} \
151+ --build-arg CIRCLE_PULL_REQUEST=${CIRCLE_PULL_REQUEST} \
152+ --build-arg PYTHON_VERSION=${PYTHON_VERSION} \
153+ --cache-from type=registry,ref=docker.io/${REPOSITORY}:${TAG}-buildcache,mode=max \
154+ --cache-to type=registry,ref=docker.io/${REPOSITORY}:${TAG}-buildcache,mode=max,image-manifest=true,oci-mediatypes=true \
155+ --progress plain \
156+ --platform linux/amd64 \
157+ --provenance=false \
158+ --sbom=false \
159+ --output type=registry,push=true \
160+ .
161+
104162 build-and-push-gpu :
105- executor : docker/docker
163+ machine :
164+ image : ubuntu-2404:current
106165 parameters :
107166 cuda-tag :
108167 type : string
@@ -116,19 +175,29 @@ jobs:
116175 PY_VERSION : << parameters.python-version >>
117176 steps :
118177 - checkout
119- - setup_remote_docker
120- - docker/check :
121- use-docker-credentials-store : true
122- - split_python_version
123- - docker/build :
124- step-name : Tensorflow GPU image
125- path : ./gpu
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"
127- image : deepnote/tensorflow
128- tag : ${TF_VERSION}${CIRCLE_PULL_REQUEST:+-ra-${CIRCLE_PULL_REQUEST##*/}}-gpu
129- - docker/push :
130- image : deepnote/tensorflow
131- tag : ${TF_VERSION}${CIRCLE_PULL_REQUEST:+-ra-${CIRCLE_PULL_REQUEST##*/}}-gpu
178+ - docker_login
179+ - split_python_version # This provides PYTHON_VERSION
180+ - setup_buildkit_builder
181+ - run :
182+ name : Build and push python image
183+ command : |
184+ REPOSITORY="deepnote/tensorflow"
185+ TAG="${TF_VERSION}${CIRCLE_PULL_REQUEST:+-ra-${CIRCLE_PULL_REQUEST##*/}}-gpu"
186+ docker buildx build \
187+ --file=./gpu/Dockerfile \
188+ --tag=978928340082.dkr.ecr.us-east-1.amazonaws.com/${REPOSITORY}:${TAG} \
189+ --tag=docker.io/${REPOSITORY}:${TAG} \
190+ --build-arg CUDA_IMAGE_TAG=${CUDA_TAG} \
191+ --build-arg TF_VERSION=${TF_VERSION} \
192+ --build-arg PYTHON_VER=${PY_VERSION} \
193+ --cache-from type=registry,ref=docker.io/${REPOSITORY}:${TAG}-buildcache,mode=max \
194+ --cache-to type=registry,ref=docker.io/${REPOSITORY}:${TAG}-buildcache,mode=max,image-manifest=true,oci-mediatypes=true \
195+ --progress plain \
196+ --platform linux/amd64 \
197+ --provenance=false \
198+ --sbom=false \
199+ --output type=registry,push=true \
200+ .
132201
133202python-versions : &python-versions
134203 - " 3.8.19"
@@ -155,6 +224,13 @@ workflows:
155224 python-version : *python-versions
156225 requires :
157226 - Python << matrix.python-version >>
227+ - build-and-push-python-conda :
228+ name : Python Conda << matrix.python-version >>
229+ matrix :
230+ parameters :
231+ python-version : *python-versions
232+ requires :
233+ - Python << matrix.python-version >>
158234
159235 - build-and-push-gpu :
160236 name : Tensorflow 2.9
0 commit comments