Page MenuHomePhabricator

[keyserver] Run `source-nvm.sh` using `bash` in `Docker` container
ClosedPublic

Authored by abosh on Jul 1 2022, 6:05 PM.
Tags
None
Referenced Files
F2835672: D4429.id14101.diff
Sat, Sep 28, 2:22 PM
Unknown Object (File)
Fri, Sep 27, 4:44 AM
Unknown Object (File)
Thu, Sep 26, 5:55 PM
Unknown Object (File)
Wed, Sep 25, 3:17 AM
Unknown Object (File)
Wed, Sep 25, 3:17 AM
Unknown Object (File)
Wed, Sep 11, 5:54 PM
Unknown Object (File)
Wed, Sep 11, 5:54 PM
Unknown Object (File)
Wed, Sep 11, 5:54 PM
Subscribers

Details

Summary

Relevant Linear issue with full context here. This diff modifies the Dockerfile in keyserver to execute source-nvm.sh in the environment specified by the shebang in source-nvm.sh instead of in the current environment of the container, which uses sh.

Read more here.

Thank you @atul for your help on this!

Test Plan

Ran the Docker keyserver build locally and it worked with no errors.

image.png (1×1 px, 424 KB)

Diff Detail

Repository
rCOMM Comm
Branch
master
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

keyserver/Dockerfile
97

A minor change tacked onto this diff because the linter was complaining:

image.png (226×2 px, 98 KB)

abosh edited the summary of this revision. (Show Details)
abosh edited the test plan for this revision. (Show Details)

Makes sense

keyserver/Dockerfile
89

Should we just do keyserver/bash/source-nvm.sh? Does the cd persist into the next command? (I think not)

This revision is now accepted and ready to land.Jul 2 2022, 6:52 PM
keyserver/Dockerfile
89

Great question! It should be fine. From the Docker docs:

The WORKDIR instruction sets the working directory for any RUN, CMD, ENTRYPOINT, COPY and ADD instructions that follow it in the Dockerfile.

Thus, the next COPY command will not be affected by the cd here.

Read more here.

keyserver/Dockerfile
89 ↗(On Diff #14120)

Based on this comment on D4429, I suspect that ./source-nvm.sh doesn't actually work to set the version of Node. But that's actually fine – we don't really rely on that here... we're running ./source-nvm.sh just to trigger nvm to download Node so it's cached in Docker. We rely on bash/run-prod.sh to handle calling nvm correctly.

The only effect here will be that commands like yarn workspace landing prod (Webpack) and yarn workspace keyserver prod-build (Babel, GeoIP download) run using Node 16.13 instead of 16.9. This is probably fine