Commit 6d96c05
authored
[nodejs planner] InputFiles should take paths relative to devbox.json, and not combined with srcDir (#212)
## Summary
~This should fix a consequence of a change introduced in #200 to make
the devbox.srcDir be an absolute path.
In the BuildPlanners, we need the paths to be relative so they are
inside the "docker context" and
can be used in Dockerfiles.~
New Fix:
I think the problem is actually scoped to just the NodeJSPlanner. Within
NodeJSPlanner, the inputFiles were being set using
`filepath.Join(srcDir, <filename>)` when instead it should be just
`<filename>`, or more pedantically `path/of/filename/from/devbox-json`.
This is because the docker-context is the directory-of-devbox-json, and
any files `COPY --link`'d should be specified with paths relative to
this docker-context.
I inspected `git grep InputFiles` and it seems NodeJSPlanner is the only
one with this issue.
I also went back in history to a commit from Monday, built the binary
and found that the following would fail due to this reason:
```
> cd testdata/nodejs
> devbox build nodejs-18
```
It works now with this fix.
## How was it tested?
in www.jetpack.io repo,
1. did `devbox build` and `docker run -p 3000:3000 --expose 3000 -ti
devbox` and could open the website in localhost:3000
2. did `cd root-of-www.jetpack.io` and did `devbox build www && docker
run -p 3000:3000 --expose 3000 -ti devbox`. Works!
3. did `mkdir -p root-of-www.jetpack.io/www/fake-dir && cd
root-of-www.jetpack.io/www/fake-dir` and then: `devbox build ../ &&
docker run -p 3000:3000 --expose 3000 -ti devbox`. Works! Also, works
with just `devbox build` i.e. omitting `../` argument (due to #200)
For NodeJS testdata in `testdata/nodejs`:
1. `cd testdata/nodejs` and `devbox build nodejs-18 && docker run
devbox`. Works!
2. `cd testdata/nodejs/nodejs-18` and `devbox build && docker run
devbox`. Works!
3. `cd testdata/nodejs/nodejs-18/fake-dir` and `devbox build && docker
run devbox`. Works!
in devbox repo,
did `devbox build` and `docker run devbox` with:
- `testdata/rust/rust-stable`
- `testdata/python/pip-example`1 parent 0bead52 commit 6d96c05
File tree
2 files changed
+8
-7
lines changed- planner/languages/javascript
- testdata/nodejs/nodejs-18
2 files changed
+8
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
118 | | - | |
| 118 | + | |
119 | 119 | | |
120 | 120 | | |
121 | | - | |
122 | | - | |
123 | | - | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
124 | 124 | | |
125 | 125 | | |
126 | | - | |
127 | | - | |
128 | | - | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
0 commit comments