Skip to content

Commit e7435fb

Browse files
authored
add *dev_packages workflows for python/noteable/* (#29)
1 parent 92289fc commit e7435fb

File tree

6 files changed

+83
-3
lines changed

6 files changed

+83
-3
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ requirements.in
1919
requirements.R
2020
run.sh
2121

22+
# Ignore these even at the parent-level directories; only to be used as placeholders for local development
23+
dev_packages
24+
2225
# ...except for these places where we care about changes happening
2326
# (NOTE: this is because the tasks should copy the files down into the build directories)
2427
!scripts/apt-install

Taskfile.python.yaml

+32-3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ version: 3
44
vars:
55
NBL_PYTHON_VERSION: 3.9
66
IDENTIFIER: base
7+
BUILD_TARGET: main
78

89
# NOTE: When using `deps: []`, variables are inherited from the current task, but when calling them
910
# directly in `cmds: []`, the variables have to be passed in explicitly.
@@ -59,7 +60,7 @@ tasks:
5960
desc: Build the Python 3.x base image after copying required files
6061
cmds:
6162
- task python:base:copy-files IDENTIFIER=base NBL_PYTHON_VERSION={{.NBL_PYTHON_VERSION}}
62-
- task build LANGUAGE=python NBL_LANGUAGE_VERSION={{.NBL_PYTHON_VERSION}} IDENTIFIER=base
63+
- task build LANGUAGE=python NBL_LANGUAGE_VERSION={{.NBL_PYTHON_VERSION}} IDENTIFIER=base BUILD_TARGET=base
6364

6465
# Base GPU image
6566
base-gpu:lock-dependencies:
@@ -133,8 +134,10 @@ tasks:
133134
- task python:datascience:build IDENTIFIER=noteable-gpu NBL_PYTHON_VERSION={{.NBL_PYTHON_VERSION}}
134135
# copy over noteable-specific files
135136
- task python:noteable:copy-files IDENTIFIER=noteable NBL_PYTHON_VERSION={{.NBL_PYTHON_VERSION}}
137+
# copy dev_packages for local builds, even if we aren't using the dev stage
138+
- sudo cp -R python/noteable/dev_packages python/noteable/{{.NBL_PYTHON_VERSION}}/
136139
# build the noteable image off of the datascience image
137-
- task build LANGUAGE=python NBL_LANGUAGE_VERSION={{.NBL_PYTHON_VERSION}} IDENTIFIER=noteable BUILD_TARGET=main -- --build-context base=docker-image://local/kernel-python-{{.NBL_PYTHON_VERSION}}-datascience:dev
140+
- task build LANGUAGE=python NBL_LANGUAGE_VERSION={{.NBL_PYTHON_VERSION}} IDENTIFIER=noteable BUILD_TARGET={{.BUILD_TARGET}} -- --build-context base=docker-image://local/kernel-python-{{.NBL_PYTHON_VERSION}}-datascience:dev
138141

139142
# Noteable GPU image
140143
noteable-gpu:lock-dependencies:
@@ -149,8 +152,10 @@ tasks:
149152
- task python:datascience-gpu:build IDENTIFIER=noteable-gpu NBL_PYTHON_VERSION={{.NBL_PYTHON_VERSION}}
150153
# copy over noteable-specific files
151154
- task python:noteable:copy-files IDENTIFIER=noteable NBL_PYTHON_VERSION={{.NBL_PYTHON_VERSION}} FILE_PREFIX="gpu."
155+
# copy dev_packages for local builds, even if we aren't using the dev stage
156+
- sudo cp -R python/noteable/gpu_dev_packages python/noteable/{{.NBL_PYTHON_VERSION}}/
152157
# build the noteable-gpu image off of the datascience-gpu image
153-
- task build LANGUAGE=python NBL_LANGUAGE_VERSION={{.NBL_PYTHON_VERSION}} IDENTIFIER=noteable BUILD_TARGET=gpu TAG_SUFFIX=-gpu -- --build-context base=docker-image://local/kernel-python-{{.NBL_PYTHON_VERSION}}-datascience-gpu:dev
158+
- task build LANGUAGE=python NBL_LANGUAGE_VERSION={{.NBL_PYTHON_VERSION}} IDENTIFIER=noteable BUILD_TARGET={{.BUILD_TARGET}} TAG_SUFFIX=-gpu -- --build-context base=docker-image://local/kernel-python-{{.NBL_PYTHON_VERSION}}-datascience-gpu:dev
154159

155160
# convenience functions for building multiple images in parallel
156161
base:lock-all-dependencies:
@@ -251,6 +256,18 @@ tasks:
251256
- task: noteable:build
252257
vars: { NBL_PYTHON_VERSION: 3.10 }
253258

259+
noteable:build-all-with-dev-packages:
260+
desc: LOCAL DEV - Build all `noteable` images with `dev_packages` included
261+
deps:
262+
- task: noteable:build
263+
vars:
264+
NBL_PYTHON_VERSION: 3.9
265+
BUILD_TARGET: dev
266+
- task: noteable:build
267+
vars:
268+
NBL_PYTHON_VERSION: 3.10
269+
BUILD_TARGET: dev
270+
254271
noteable-gpu:lock-all-dependencies:
255272
desc: Lock Python dependencies for all Python 3.x GPU builds using pip-compile
256273
deps:
@@ -267,6 +284,18 @@ tasks:
267284
- task: noteable-gpu:build
268285
vars: { NBL_PYTHON_VERSION: 3.10 }
269286

287+
noteable-gpu:build-all-with-dev-packages:
288+
desc: LOCAL DEV - Build all `noteable` images with `gpu_dev_packages` included
289+
deps:
290+
- task: noteable-gpu:build
291+
vars:
292+
NBL_PYTHON_VERSION: 3.9
293+
BUILD_TARGET: gpu-dev
294+
- task: noteable-gpu:build
295+
vars:
296+
NBL_PYTHON_VERSION: 3.10
297+
BUILD_TARGET: gpu-dev
298+
270299
# convenience functions for building all images
271300
lock-all-dependencies:
272301
desc: Lock Python dependencies for all Python 3.x builds using pip-compile

python/noteable/3.10/Dockerfile

+24
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,32 @@ COPY ipython_config.py /etc/ipython
3737
COPY git_credential_helper.py /git_credential_helper.py
3838
COPY git-wrapper.sh /usr/local/bin/git
3939

40+
# hadolint ignore=DL3007
41+
FROM main AS dev
42+
43+
# Copy any local packages into the image for development/testing
44+
COPY ./dev_packages /dev_packages
45+
RUN if [ "$(ls /dev_packages)" ]; then \
46+
pip install --no-cache-dir /dev_packages/* && \
47+
python -c "import dx, noteable, psutil, sidecar_comms"; \
48+
else \
49+
echo "No dev_packages to install"; \
50+
fi
51+
4052
# hadolint ignore=DL3006
4153
FROM main as gpu
4254

4355
COPY gpu.requirements.txt /tmp/noteable_gpu_requirements.txt
4456
RUN pip install --no-cache-dir -r /tmp/noteable_gpu_requirements.txt
57+
58+
# hadolint ignore=DL3007
59+
FROM gpu AS gpu-dev
60+
61+
# Copy any local packages into the image for development/testing
62+
COPY ./gpu_dev_packages /gpu_dev_packages
63+
RUN if [ "$(ls /gpu_dev_packages)" ]; then \
64+
pip install --no-cache-dir /gpu_dev_packages/* && \
65+
python -c "import dx, noteable, psutil, sidecar_comms"; \
66+
else \
67+
echo "No gpu_dev_packages to install"; \
68+
fi

python/noteable/3.9/Dockerfile

+24
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,32 @@ COPY ipython_config.py /etc/ipython
3737
COPY git_credential_helper.py /git_credential_helper.py
3838
COPY git-wrapper.sh /usr/local/bin/git
3939

40+
# hadolint ignore=DL3007
41+
FROM main AS dev
42+
43+
# Copy any local packages into the image for development/testing
44+
COPY ./dev_packages /dev_packages
45+
RUN if [ "$(ls /dev_packages)" ]; then \
46+
pip install --no-cache-dir /dev_packages/* && \
47+
python -c "import dx, noteable, psutil, sidecar_comms"; \
48+
else \
49+
echo "No dev_packages to install"; \
50+
fi
51+
4052
# hadolint ignore=DL3006
4153
FROM main as gpu
4254

4355
COPY gpu.requirements.txt /tmp/noteable_gpu_requirements.txt
4456
RUN pip install --no-cache-dir -r /tmp/noteable_gpu_requirements.txt
57+
58+
# hadolint ignore=DL3007
59+
FROM gpu AS gpu-dev
60+
61+
# Copy any local packages into the image for development/testing
62+
COPY ./gpu_dev_packages /gpu_dev_packages
63+
RUN if [ "$(ls /gpu_dev_packages)" ]; then \
64+
pip install --no-cache-dir /gpu_dev_packages/* && \
65+
python -c "import dx, noteable, psutil, sidecar_comms"; \
66+
else \
67+
echo "No gpu_dev_packages to install"; \
68+
fi

python/noteable/dev_packages/.gitkeep

Whitespace-only changes.

python/noteable/gpu_dev_packages/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)