-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixup #2
base: od-dockerize-nextjs
Are you sure you want to change the base?
Fixup #2
Conversation
"node", | ||
dev_dependency = True, | ||
) | ||
use_repo(node, "nodejs_toolchains") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needed on MacOS under bzlmod to run
--extra_toolchains=@nodejs_toolchains//:linux_arm64_toolchain_target
WORKSPACE does not have this issue on transitions
], | ||
) | ||
|
||
next_bin.next_binary( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of a js_run_devserver
binary which is for local development and won't work in a container, what you want for the image is just a js_binary
which is what next_bin.next_binary
is under the hood
name = "image", | ||
base = "@debian_node", | ||
cmd = ["/app/next.js/next_js_start"], | ||
workdir = "/app/next.js/next_js_start.runfiles/_main", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
workdir
must be set to the root of the runfiles tree in the container
js_image_layer( | ||
name = "layers", | ||
binary = ":next_js_start", | ||
platform = select({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For transitioning the target platform to linux for for the container runtime so the image can be built locally on a mac
Related to aspect-build/rules_js#1530 |
On MacOS, bzlmod node toolchains have a bug for transitions so to build the image with the correct node toolchain you need add
--extra_toolchains
:That followed by
should start the webserver