Skip to content

Commit f5f303e

Browse files
authored
[deno] add intermediate packages build (#47)
1 parent 0854954 commit f5f303e

File tree

7 files changed

+62
-8
lines changed

7 files changed

+62
-8
lines changed

.github/workflows/build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ jobs:
190190
packages: write
191191
strategy:
192192
matrix:
193-
version: ["1.37-dev"]
193+
version: ["1.37"]
194194
env:
195195
VERSION: ${{ matrix.version }}
196196
BUILD_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
.Rprofile
77
apt-install
88
Aptfile
9+
deps.ts
910
environment.txt
1011
git_credential_helper.py
1112
git-wrapper.sh
@@ -40,10 +41,13 @@ run.sh
4041

4142
!python/base-gpu/initial-condarc
4243

44+
!deno/packages/deps.ts
45+
4346
!python/base/requirements.in
4447
!python/datascience/requirements.in
4548
!python/noteable/requirements.in
4649

50+
!deno/packages/run.sh
4751
!python/run.sh
4852
!python/base-gpu/run.sh
4953
!r/run.sh

Taskfile.deno.yaml

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: 3
22

33
vars:
4-
NBL_DENO_VERSION: 1.37-dev
4+
NBL_DENO_VERSION: 1.37
55
IDENTIFIER: base
66

77
# NOTE: When using `deps: []`, variables are inherited from the current task, but when calling them
@@ -21,9 +21,20 @@ tasks:
2121
cmds:
2222
- task copy-root-files LANGUAGE=deno IDENTIFIER={{.IDENTIFIER}} NBL_LANGUAGE_VERSION={{.NBL_DENO_VERSION}}
2323
- task copy-language-files LANGUAGE=deno IDENTIFIER={{.IDENTIFIER}} NBL_LANGUAGE_VERSION={{.NBL_DENO_VERSION}}
24+
- cp deno/packages/deps.ts deno/packages/{{.NBL_DENO_VERSION}}/deps.ts
2425

2526
base:build:
2627
desc: Build the Deno base image after copying required files
2728
cmds:
2829
- task deno:base:copy-files IDENTIFIER=base NBL_LANGUAGE_VERSION={{.NBL_DENO_VERSION}}
2930
- task deno:core:build IDENTIFIER=base NBL_DENO_VERSION={{.NBL_DENO_VERSION}}
31+
32+
packages:build:
33+
desc: Build the Deno 1.3x image with commonly-installed packages
34+
cmds:
35+
# ensure the base image is built first
36+
- task deno:base:build IDENTIFIER=packages NBL_DENO_VERSION={{.NBL_DENO_VERSION}}
37+
# copy adjusted lockfile
38+
- cp deno/packages/deps.ts deno/packages/{{.NBL_DENO_VERSION}}/deps.ts
39+
# build the packages image off of the base image
40+
- 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
File renamed without changes.

deno/packages/1.37/Dockerfile

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# syntax = docker/dockerfile:1.5
2+
# Packages build: imports/caches commonly-installed packages to ease load time
3+
# hadolint ignore=DL3006
4+
FROM base as main
5+
6+
USER noteable
7+
8+
# Copy and cache our desired imports
9+
COPY ./deps.ts /tmp/deps.ts
10+
RUN deno cache /tmp/deps.ts

deno/packages/deps.ts

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import "https://deno.land/std/assert/mod.ts";
2+
import "https://deno.land/x/[email protected]/mod.ts";
3+
import "https://deno.land/x/deno_dom/deno-dom-wasm-noinit.ts";
4+
import "https://deno.land/x/display/mod.ts";
5+
import "https://deno.land/x/skia_canvas/mod.ts";
6+
7+
import "https://esm.sh/jsdom";
8+
import "https://esm.sh/twind";
9+
10+
import "npm:apache-arrow";
11+
import "npm:d3";
12+
import "npm:express";
13+
import "npm:nodejs-polars";
14+
import "npm:react";
15+
import "npm:vega-lite-api";

docker-bake.hcl

+20-6
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,15 @@ variable "TIMESTAMP" {
3030
# Group of Deno targets
3131
group "deno" {
3232
targets = [
33-
"deno_1_37-dev",
33+
"deno_1_37",
3434
]
3535
}
3636

3737
# Group of Deno 1.37 targets
38-
group "deno_1_37-dev" {
38+
group "deno_1_37" {
3939
targets = [
40-
"deno_base_1_37-dev",
40+
"deno_base_1_37",
41+
"deno_packages_1_37",
4142
]
4243
}
4344

@@ -399,12 +400,25 @@ target "rust_base_1_70_0" {
399400
]
400401
}
401402

402-
# Base Deno 1.37-dev image
403-
target "deno_base_1_37-dev" {
403+
# Base Deno 1.37 image
404+
target "deno_base_1_37" {
404405
inherits = ["base"]
405-
context = "deno/base/1.37-dev"
406+
context = "deno/base/1.37"
406407
tags = [
407408
"ghcr.io/noteable-io/kernel-deno-1.37-base:${TAG}",
408409
notequal("", HANDLE) ? "ghcr.io/noteable-io/kernel-deno-1.37-base:${HANDLE}" : ""
409410
]
410411
}
412+
413+
# Deno 1.37 packages variant
414+
target "deno_packages_1_37" {
415+
context = "deno/packages/1.37"
416+
contexts = {
417+
base = "target:deno_base_1_37"
418+
}
419+
target = "main"
420+
tags = [
421+
"ghcr.io/noteable-io/kernel-deno-1.37-packages:${TAG}",
422+
notequal("", HANDLE) ? "ghcr.io/noteable-io/kernel-deno-1.37-packages:${HANDLE}" : ""
423+
]
424+
}

0 commit comments

Comments
 (0)