Skip to content

Commit

Permalink
feat: split js_image_layer into 5 layers
Browse files Browse the repository at this point in the history
  • Loading branch information
gregmagolan committed May 8, 2024
1 parent 66a2a55 commit 6727245
Show file tree
Hide file tree
Showing 24 changed files with 789 additions and 274 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Input hashes for repository rule npm_translate_lock(name = "npm", pnpm_lock = "@@//:pnpm-lock.yaml").
# This file should be checked into version control along with the pnpm-lock.yaml file.
.npmrc=-2065072158
pnpm-lock.yaml=1142601305
pnpm-lock.yaml=-481966245
examples/npm_deps/patches/meaning-of-life@1.0.0-pnpm.patch=-442666336
package.json=-275319675
pnpm-workspace.yaml=-1178830835
Expand All @@ -23,5 +23,5 @@ npm/private/test/vendored/semver-max/package.json=578664053
examples/linked_empty_node_modules/package.json=-1039372825
examples/npm_package/packages/pkg_d/package.json=1110895851
js/private/image/package.json=-1260474848
js/private/test/image/package.json=1286417612
js/private/test/image/package.json=-687546763
js/private/test/js_run_devserver/package.json=-260856079
3 changes: 3 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ common --lockfile_mode=off
# Mock versioning command to test the --stamp behavior
build --workspace_status_command="echo BUILD_SCM_VERSION 1.2.3"

# Workaround for https://github.com/aspect-build/rules_js/issues/1530
build --extra_toolchains=@nodejs_toolchains//:linux_arm64_toolchain_target

# Load any settings specific to the current user.
# .bazelrc.user should appear in .gitignore so that settings are not shared with team members
# This needs to be last statement in this
Expand Down
54 changes: 45 additions & 9 deletions docs/js_image_layer.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

54 changes: 45 additions & 9 deletions e2e/js_image_docker/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -47,25 +47,58 @@ js_image_layer(
)

filegroup(
name = "app_tar",
name = "node_tar",
srcs = [":layers"],
output_group = "app",
output_group = "node",
)

container_layer(
name = "app_layer",
tars = [":app_tar"],
name = "node_layer",
tars = [":node_tar"],
)

filegroup(
name = "node_modules_tar",
name = "package_store_3p_tar",
srcs = [":layers"],
output_group = "node_modules",
output_group = "package_store_3p",
)

container_layer(
name = "node_modules_layer",
tars = [":node_modules_tar"],
name = "package_store_3p_layer",
tars = [":package_store_3p_tar"],
)

filegroup(
name = "package_store_1p_tar",
srcs = [":layers"],
output_group = "package_store_1p",
)

container_layer(
name = "package_store_1p_layer",
tars = [":package_store_1p_tar"],
)

filegroup(
name = "node_modules_links_tar",
srcs = [":layers"],
output_group = "node_modules_links",
)

container_layer(
name = "node_modules_links_layer",
tars = [":node_modules_links_tar"],
)

filegroup(
name = "app_tar",
srcs = [":layers"],
output_group = "app",
)

container_layer(
name = "app_layer",
tars = [":app_tar"],
)

container_image(
Expand All @@ -77,8 +110,11 @@ container_image(
cmd = ["/app/bin"],
entrypoint = ["bash"],
layers = [
":node_layer",
":package_store_3p_layer",
":package_store_1p_layer",
":node_modules_links_layer",
":app_layer",
":node_modules_layer",
],
# This is `cmd` + `.runfiles/[workspace name]`
workdir = select({
Expand Down
Loading

0 comments on commit 6727245

Please sign in to comment.