-
Notifications
You must be signed in to change notification settings - Fork 6
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
Omit dev deps when installing Auspice #165
Conversation
I think this is getting skunked by the old version of npm (v6) in the image, which I only noted because I saw this warning float by:
|
#122, hopefully to be merged soon, will bring a newer version of npm. |
Confirmed that with newer npm in the container this works fine. commit d38eb85c003fb738cec4a7df7aabc768ec610149
Author: Thomas Sibley <tsibley@fredhutch.org>
Date: Fri Jun 23 10:11:25 2023 -0700
wip! upgrade npm
diff --git a/Dockerfile b/Dockerfile
index 569bfd7..e248fdf 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -35,7 +35,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
# Install a specific Node.js version
# https://github.com/nodesource/distributions/blob/0d81da75/README.md#installation-instructions
RUN curl -fsSL https://deb.nodesource.com/setup_14.x | bash - \
- && apt-get update && apt-get install -y nodejs
+ && apt-get update && apt-get install -y nodejs && npm install -g npm@8
# Used for platform-specific instructions
ARG TARGETPLATFORM Will test some more locally, clean up, and then mark for review. |
69e468c
to
693d639
Compare
75e2680
to
bbda96b
Compare
This was introduced incidentally, and seemingly unintentionally¹, in "Replace Alpine-based image with a Debian-based image" (ce07dad), but no one noticed. `npm update` is unwarranted because it's intended for maintainers of a package, not downstream user installs, which is the role we have here. Its effect was to bump the minimum versions in Auspice's package.json to the latest available (while still respecting SemVer constraints) and then install all of Auspice's deps into node_modules/.² That's unnecessary because we then run `npm install`, which unlike `npm update`, also runs pre/post-installation steps Auspice includes. ¹ <#21 (comment)> ² Notably, `npm update` was added when the image had npm v5, which updates both package.json and package-lock.json. We currently have npm v6, which does the same. Subsequent versions, e.g. npm v8, stopped updating package.json and only update package-lock.json.
This avoids disk-heavy deps like Puppeteer, which bundle a whole Chromium install. Based on some rough comparisons, I expected this to shave about 600MB from the uncompressed image size and a local test build bore that out. The node_modules/ tree is infamously large and bloated. The usual culprits are non-source files that are commonly included in package distributions but not needed at run time. So there is surely more we could shave off here, but this is a huge easy start.
693d639
to
d5d1662
Compare
Dropped the |
This avoids disk-heavy deps like Puppeteer, which bundle a whole Chromium install. Based on some rough comparisons, I expected this to shave about 600MB from the uncompressed image size and a local test build bore that out.
The node_modules/ tree is infamously large and bloated. The usual culprits are non-source files that are commonly included in package distributions but not needed at run time. So there is surely more we could shave off here, but this is a huge easy start.
Testing