Skip to content

Commit

Permalink
[deno] add intermediate packages build (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
shouples committed Sep 19, 2023
1 parent 0854954 commit f5f303e
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ jobs:
packages: write
strategy:
matrix:
version: ["1.37-dev"]
version: ["1.37"]
env:
VERSION: ${{ matrix.version }}
BUILD_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
.Rprofile
apt-install
Aptfile
deps.ts
environment.txt
git_credential_helper.py
git-wrapper.sh
Expand Down Expand Up @@ -40,10 +41,13 @@ run.sh

!python/base-gpu/initial-condarc

!deno/packages/deps.ts

!python/base/requirements.in
!python/datascience/requirements.in
!python/noteable/requirements.in

!deno/packages/run.sh
!python/run.sh
!python/base-gpu/run.sh
!r/run.sh
Expand Down
13 changes: 12 additions & 1 deletion Taskfile.deno.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: 3

vars:
NBL_DENO_VERSION: 1.37-dev
NBL_DENO_VERSION: 1.37
IDENTIFIER: base

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

base:build:
desc: Build the 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}}

packages:build:
desc: Build the Deno 1.3x image with commonly-installed packages
cmds:
# ensure the base image is built first
- task deno:base:build IDENTIFIER=packages NBL_DENO_VERSION={{.NBL_DENO_VERSION}}
# 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
File renamed without changes.
10 changes: 10 additions & 0 deletions deno/packages/1.37/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# syntax = docker/dockerfile:1.5
# Packages build: imports/caches commonly-installed packages to ease load time
# hadolint ignore=DL3006
FROM base as main

USER noteable

# Copy and cache our desired imports
COPY ./deps.ts /tmp/deps.ts
RUN deno cache /tmp/deps.ts
15 changes: 15 additions & 0 deletions deno/packages/deps.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import "https://deno.land/std/assert/mod.ts";
import "https://deno.land/x/[email protected]/mod.ts";
import "https://deno.land/x/deno_dom/deno-dom-wasm-noinit.ts";
import "https://deno.land/x/display/mod.ts";
import "https://deno.land/x/skia_canvas/mod.ts";

import "https://esm.sh/jsdom";
import "https://esm.sh/twind";

import "npm:apache-arrow";
import "npm:d3";
import "npm:express";
import "npm:nodejs-polars";
import "npm:react";
import "npm:vega-lite-api";
26 changes: 20 additions & 6 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@ variable "TIMESTAMP" {
# Group of Deno targets
group "deno" {
targets = [
"deno_1_37-dev",
"deno_1_37",
]
}

# Group of Deno 1.37 targets
group "deno_1_37-dev" {
group "deno_1_37" {
targets = [
"deno_base_1_37-dev",
"deno_base_1_37",
"deno_packages_1_37",
]
}

Expand Down Expand Up @@ -399,12 +400,25 @@ target "rust_base_1_70_0" {
]
}

# Base Deno 1.37-dev image
target "deno_base_1_37-dev" {
# Base Deno 1.37 image
target "deno_base_1_37" {
inherits = ["base"]
context = "deno/base/1.37-dev"
context = "deno/base/1.37"
tags = [
"ghcr.io/noteable-io/kernel-deno-1.37-base:${TAG}",
notequal("", HANDLE) ? "ghcr.io/noteable-io/kernel-deno-1.37-base:${HANDLE}" : ""
]
}

# Deno 1.37 packages variant
target "deno_packages_1_37" {
context = "deno/packages/1.37"
contexts = {
base = "target:deno_base_1_37"
}
target = "main"
tags = [
"ghcr.io/noteable-io/kernel-deno-1.37-packages:${TAG}",
notequal("", HANDLE) ? "ghcr.io/noteable-io/kernel-deno-1.37-packages:${HANDLE}" : ""
]
}

0 comments on commit f5f303e

Please sign in to comment.