Skip to content

Commit

Permalink
clean up taskfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
shouples committed Oct 18, 2023
1 parent 1d4bd3f commit dbbc2e8
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 34 deletions.
26 changes: 23 additions & 3 deletions Taskfile.R.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,13 @@ tasks:
cmds:
- task r:base:copy-files IDENTIFIER=base NBL_LANGUAGE_VERSION={{.NBL_R_VERSION}}
# build the base image
- task build LANGUAGE=r NBL_LANGUAGE_VERSION={{.NBL_R_VERSION}} IDENTIFIER=base -- --build-arg NBL_R_VERSION={{.NBL_R_VERSION}}
- >-
task build \
LANGUAGE=r \
NBL_LANGUAGE_VERSION={{.NBL_R_VERSION}} \
IDENTIFIER=base \
-- \
--build-arg NBL_R_VERSION={{.NBL_R_VERSION}}
datascience:build:
desc: Build the R 4.3.x image with commonly-installed packages
Expand All @@ -38,7 +44,14 @@ tasks:
- cp r/datascience/install_packages.R r/datascience/{{.NBL_R_VERSION}}/install_packages.R
- cp r/datascience/requirements.R r/datascience/{{.NBL_R_VERSION}}/requirements.R
# build the datascience image off of the base image
- task build LANGUAGE=r NBL_LANGUAGE_VERSION={{.NBL_R_VERSION}} IDENTIFIER=datascience BUILD_TARGET=main -- --build-context base=docker-image://local/kernel-r-{{.NBL_R_VERSION}}-base:dev
- >-
task build \
LANGUAGE=r \
NBL_LANGUAGE_VERSION={{.NBL_R_VERSION}} \
IDENTIFIER=datascience \
BUILD_TARGET=main \
-- \
--build-context base=docker-image://local/kernel-r-{{.NBL_R_VERSION}}-base:dev
noteable:build:
desc: Build the R 4.3.x image with data frame -> DEX support
Expand All @@ -50,4 +63,11 @@ tasks:
- cp r/noteable/.Rprofile r/noteable/{{.NBL_R_VERSION}}/.Rprofile
- cp r/noteable/requirements.R r/noteable/{{.NBL_R_VERSION}}/requirements.R
# build the noteable image off of the datascience image
- task build LANGUAGE=r NBL_LANGUAGE_VERSION={{.NBL_R_VERSION}} IDENTIFIER=noteable BUILD_TARGET=main -- --build-context base=docker-image://local/kernel-r-{{.NBL_R_VERSION}}-datascience:dev
- >-
task build \
LANGUAGE=r \
NBL_LANGUAGE_VERSION={{.NBL_R_VERSION}} \
IDENTIFIER=noteable \
BUILD_TARGET=main \
-- \
--build-context base=docker-image://local/kernel-r-{{.NBL_R_VERSION}}-datascience:dev
27 changes: 15 additions & 12 deletions Taskfile.deno.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,6 @@ vars:
# NOTE: When using `deps: []`, variables are inherited from the current task, but when calling them
# directly in `cmds: []`, the variables have to be passed in explicitly.
tasks:
core:build:
desc: Build the Deno image
cmds:
- >-
docker build deno/{{.IDENTIFIER}}/{{.NBL_DENO_VERSION}} \
--build-arg "NBL_DENO_VERSION={{.NBL_DENO_VERSION}}" \
--build-arg "BASE_IMAGE={{.BASE_IMAGE}}" \
--tag "local/kernel-deno-{{.NBL_DENO_VERSION}}-{{.IDENTIFIER}}:dev"
base:copy-files:
desc: Copy files from the Deno directory to the build directories
cmds:
Expand All @@ -24,10 +15,15 @@ tasks:
- cp deno/packages/deps.ts deno/packages/{{.NBL_DENO_VERSION}}/deps.ts

base:build:
desc: Build the Deno base image after copying required files
desc: Build the (Typescript) Deno base image after copying required files
cmds:
- task deno:base:copy-files IDENTIFIER=base NBL_LANGUAGE_VERSION={{.NBL_DENO_VERSION}}
- task deno:core:build IDENTIFIER=base NBL_DENO_VERSION={{.NBL_DENO_VERSION}}
- >-
task build \
LANGUAGE=deno \
NBL_LANGUAGE_VERSION={{.NBL_DENO_VERSION}} \
IDENTIFIER=base
# no --build-arg NBL_DENO_VERSION since it isn't used for the actual build process

packages:build:
desc: Build the Deno 1.3x image with commonly-installed packages
Expand All @@ -37,4 +33,11 @@ tasks:
# copy adjusted lockfile
- cp deno/packages/deps.ts deno/packages/{{.NBL_DENO_VERSION}}/deps.ts
# build the packages image off of the base image
- task build LANGUAGE=deno NBL_LANGUAGE_VERSION={{.NBL_DENO_VERSION}} IDENTIFIER=packages BUILD_TARGET=main -- --build-context base=docker-image://local/kernel-deno-{{.NBL_DENO_VERSION}}-base:dev
- >-
task build \
LANGUAGE=deno \
NBL_LANGUAGE_VERSION={{.NBL_DENO_VERSION}} \
IDENTIFIER=packages \
BUILD_TARGET=main \
-- \
--build-context base=docker-image://local/kernel-deno-{{.NBL_DENO_VERSION}}-base:dev
68 changes: 59 additions & 9 deletions Taskfile.python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ version: 3
vars:
NBL_PYTHON_VERSION: 3.9
IDENTIFIER: base
BUILD_TARGET: main

# NOTE: When using `deps: []`, variables are inherited from the current task, but when calling them
# directly in `cmds: []`, the variables have to be passed in explicitly.
Expand Down Expand Up @@ -60,7 +59,13 @@ tasks:
desc: Build the Python 3.x base image after copying required files
cmds:
- task python:base:copy-files IDENTIFIER=base NBL_PYTHON_VERSION={{.NBL_PYTHON_VERSION}}
- task build LANGUAGE=python NBL_LANGUAGE_VERSION={{.NBL_PYTHON_VERSION}} IDENTIFIER=base BUILD_TARGET=base
- >-
task build \
LANGUAGE=python \
NBL_LANGUAGE_VERSION={{.NBL_PYTHON_VERSION}} \
IDENTIFIER=base \
-- \
--build-arg NBL_PYTHON_VERSION={{.NBL_PYTHON_VERSION}}
# Base GPU image
base-gpu:lock-dependencies:
Expand All @@ -81,7 +86,14 @@ tasks:
- cp python/base-gpu/run.sh python/base-gpu/{{.NBL_PYTHON_VERSION}}/run.sh
- cp python/base-gpu/initial-condarc python/base-gpu/{{.NBL_PYTHON_VERSION}}/initial-condarc
# build the base-gpu image off of the base image
- task build LANGUAGE=python NBL_LANGUAGE_VERSION={{.NBL_PYTHON_VERSION}} IDENTIFIER=base-gpu BUILD_TARGET=main -- --build-context base=docker-image://local/kernel-python-{{.NBL_PYTHON_VERSION}}-base:dev
- >-
task build \
LANGUAGE=python \
NBL_LANGUAGE_VERSION={{.NBL_PYTHON_VERSION}} \
IDENTIFIER=base-gpu \
BUILD_TARGET=main \
-- \
--build-context base=docker-image://local/kernel-python-{{.NBL_PYTHON_VERSION}}-base:dev
# Datascience image
datascience:lock-dependencies:
Expand All @@ -95,7 +107,14 @@ tasks:
# ensure the base image is built first
- task python:base:build IDENTIFIER=datascience NBL_PYTHON_VERSION={{.NBL_PYTHON_VERSION}}
# build the datascience image off of the base image
- task build LANGUAGE=python NBL_LANGUAGE_VERSION={{.NBL_PYTHON_VERSION}} IDENTIFIER=datascience BUILD_TARGET=main -- --build-context base=docker-image://local/kernel-python-{{.NBL_PYTHON_VERSION}}-base:dev
- >-
task build \
LANGUAGE=python \
NBL_LANGUAGE_VERSION={{.NBL_PYTHON_VERSION}} \
IDENTIFIER=datascience \
BUILD_TARGET=main \
-- \
--build-context base=docker-image://local/kernel-python-{{.NBL_PYTHON_VERSION}}-base:dev
# Datascience GPU image
datascience-gpu:lock-dependencies:
Expand All @@ -109,7 +128,15 @@ tasks:
# ensure the base-gpu image is built first
- task python:base-gpu:build IDENTIFIER=datascience NBL_PYTHON_VERSION={{.NBL_PYTHON_VERSION}}
# build the datascience-gpu image off of the base-gpu image
- task build LANGUAGE=python NBL_LANGUAGE_VERSION={{.NBL_PYTHON_VERSION}} IDENTIFIER=datascience BUILD_TARGET=gpu TAG_SUFFIX=-gpu -- --build-context base=docker-image://local/kernel-python-{{.NBL_PYTHON_VERSION}}-base-gpu:dev
- >-
task build \
LANGUAGE=python \
NBL_LANGUAGE_VERSION={{.NBL_PYTHON_VERSION}} \
IDENTIFIER=datascience \
BUILD_TARGET=gpu \
TAG_SUFFIX=-gpu \
-- \
--build-context base=docker-image://local/kernel-python-{{.NBL_PYTHON_VERSION}}-base-gpu:dev
# Noteable image
noteable:copy-files:
Expand All @@ -135,14 +162,25 @@ tasks:
# copy over noteable-specific files
- task python:noteable:copy-files IDENTIFIER=noteable NBL_PYTHON_VERSION={{.NBL_PYTHON_VERSION}}
# build the noteable image off of the datascience image
- 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
- >-
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
noteable:build-with-dev-packages:
desc: LOCAL DEV - Build the Python 3.x image with "Noteable feature"-related packages (SQL, git integration, DEX, etc) and dev_packages extending the datascience image of the same version
cmds:
# copy dev_packages in and then build with BUILD_TARGET specified
- sudo cp -R python/noteable/dev_packages python/noteable/{{.NBL_PYTHON_VERSION}}/
- task python:noteable:build IDENTIFIER=noteable NBL_PYTHON_VERSION={{.NBL_PYTHON_VERSION}} BUILD_TARGET=dev
- >-
task python:noteable:build \
IDENTIFIER=noteable \
NBL_PYTHON_VERSION={{.NBL_PYTHON_VERSION}} \
BUILD_TARGET=dev
# Noteable GPU image
noteable-gpu:lock-dependencies:
Expand All @@ -158,14 +196,26 @@ tasks:
# copy over noteable-specific files
- task python:noteable:copy-files IDENTIFIER=noteable NBL_PYTHON_VERSION={{.NBL_PYTHON_VERSION}} FILE_PREFIX="gpu."
# build the noteable-gpu image off of the datascience-gpu image
- 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
- >-
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
noteable-gpu:build-with-dev-packages:
desc: LOCAL DEV - Build the Python 3.x image with "Noteable feature"-related packages (SQL, git integration, DEX, etc), GPU support, and dev_packages
cmds:
# copy dev_packages in and then build with BUILD_TARGET specified
- sudo cp -R python/noteable/gpu_dev_packages python/noteable/{{.NBL_PYTHON_VERSION}}/
- task python:noteable-gpu:build IDENTIFIER=noteable NBL_PYTHON_VERSION={{.NBL_PYTHON_VERSION}} BUILD_TARGET=gpu-dev
- >-
task python:noteable-gpu:build \
IDENTIFIER=noteable \
NBL_PYTHON_VERSION={{.NBL_PYTHON_VERSION}} \
BUILD_TARGET=gpu-dev
# convenience functions for building multiple images in parallel
base:lock-all-dependencies:
Expand Down
17 changes: 7 additions & 10 deletions Taskfile.rust.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,6 @@ vars:
# NOTE: When using `deps: []`, variables are inherited from the current task, but when calling them
# directly in `cmds: []`, the variables have to be passed in explicitly.
tasks:
core:build:
desc: Build the Rust 1.x image
cmds:
- >-
docker build rust/{{.IDENTIFIER}}/{{.NBL_RUST_VERSION}} \
--build-arg "NBL_RUST_VERSION={{.NBL_RUST_VERSION}}" \
--build-arg "BASE_IMAGE={{.BASE_IMAGE}}" \
--tag "local/kernel-rust-{{.NBL_RUST_VERSION}}-{{.IDENTIFIER}}:dev"
base:copy-files:
desc: Copy files from the Rust directory to the build directories
cmds:
Expand All @@ -27,4 +18,10 @@ tasks:
desc: Build the Rust 1.x base image after copying required files
cmds:
- task rust:base:copy-files IDENTIFIER=base NBL_LANGUAGE_VERSION={{.NBL_RUST_VERSION}}
- task rust:core:build IDENTIFIER=base NBL_RUST_VERSION={{.NBL_RUST_VERSION}}
- >-
task build \
LANGUAGE=rust \
NBL_LANGUAGE_VERSION={{.NBL_RUST_VERSION}} \
IDENTIFIER=base \
-- \
--build-arg NBL_RUST_VERSION={{.NBL_RUST_VERSION}}

0 comments on commit dbbc2e8

Please sign in to comment.