Open markusthoemmes opened 4 years ago
@markusthoemmes don't we have to base our images on ubi-8 (or something that is under RH control)?
@markusthoemmes I totally agree! But it is based on ubi8-minimal
with only Node.js and the source code added. But 322MB still seems quite large and doesn't really add up
The ubi8-minimal
image itself is 142MB and the Buildpack stack
images based on it are 165MB. The installed size of Node.js is around 30MB. That should bring the faas-stack-run
image size to 195MB. But looking at it now, it's showing 291MB. I'll have to dig a bit to better understand why it's not closer to the quarkus native image, for example.
❯ docker images | grep faas-stack-run
quay.io/boson/faas-stack-run quarkus-jvm-v0.4.0 5aae334ac341 2 weeks ago 380MB
quay.io/boson/faas-stack-run go-v0.4.0 fc65455a71e1 2 weeks ago 165MB
quay.io/boson/faas-stack-run nodejs-v0.4.0 2650e0a0a711 2 weeks ago 291MB
quay.io/boson/faas-stack-run quarkus-native-v0.3.2 d6528e8a36a1 3 weeks ago 165MB
quay.io/boson/faas-stack-run quarkus-jvm-v0.3.2 8c06eca11bc8 3 weeks ago 380MB
quay.io/boson/faas-stack-run go-v0.3.2 ace209bca60d 3 weeks ago 165MB
quay.io/boson/faas-stack-run nodejs-v0.3.2 d64b90cfa965 3 weeks ago 292MB
quay.io/boson/faas-stack-run ubi8-minimal-tip e6fc06463fab 3 weeks ago 165MB
quay.io/boson/faas-stack-run ubi8-minimal-v0.3.2 e6fc06463fab 3 weeks ago 165MB
quay.io/boson/faas-stack-run ubi8-tip b72e813d337d 3 weeks ago 203MB
quay.io/boson/faas-stack-run ubi8-v0.3.2 b72e813d337d 3 weeks ago 203MB
quay.io/boson/faas-stack-run quarkus-native-tip 46f9ce388bf0 3 weeks ago 165MB
quay.io/boson/faas-stack-run quarkus-jvm-tip 35d0ec00d1ef 3 weeks ago 380MB
quay.io/boson/faas-stack-run quarkus-jvm-v0.3.1 0dd706a8f352 4 weeks ago 380MB
quay.io/boson/faas-stack-run quarkus-native-v0.3.1 deef038d55d4 4 weeks ago 165MB
quay.io/boson/faas-stack-run go-v0.3.1 687fb885f8b3 5 weeks ago 165MB
quay.io/boson/faas-stack-run nodejs-v0.3.1 8eede38c3ac6 5 weeks ago 291MB
quay.io/boson/faas-stack-run nodejs-v0.2.3 3bed4da92b95 7 weeks ago 291MB
quay.io/boson/faas-stack-run go-tip b2d9cd90cea9 2 months ago 165MB
quay.io/boson/faas-stack-run nodejs-tip 534762f4af43 2 months ago 291MB
FWIW I was just in a meeting last week with the RHEL folks and they are aware that ubi8-minimal
is not really that minimal, and I believe there are some hazy plans around improving this. That still doesn't explain why the Node.js image is quite so big. But FYI.
A bit confused about what's going on here. As you can see from the log, we're building the run image based on faas-stack-run:ubi8-minimal
. Which is 165MB. Later in the log, you can see that I'm installing Node.js (should change to not install docs), and the total install size is about 27MB. So the final image should definitely be under 200MB. But the final size of the run image is > 300MB. Why is this?
quay.io/boson/faas-stack-run nodejs-tip cd393d626d2f 6 minutes ago 301MB
❯ docker images | grep faas-stack | grep ubi
quay.io/boson/faas-stack-build ubi8-minimal-tip 0a56a0da54e1 4 hours ago 165MB
quay.io/boson/faas-stack-run ubi8-minimal-tip 0a56a0da54e1 4 hours ago 165MB
BUILDING quay.io/boson/faas-stack-run:nodejs-tip...
Sending build context to Docker daemon 3.072kB
Step 1/15 : ARG version=tip
Step 2/15 : FROM quay.io/boson/faas-stack-run:ubi8-minimal-${version}
---> 0a56a0da54e1
Step 3/15 : ARG stack_id
---> Using cache
---> 8962663145bc
Step 4/15 : ENV CNB_STACK_ID=${stack_id}
---> Running in 3398af38f0e3
Removing intermediate container 3398af38f0e3
---> 62eac1856fc0
Step 5/15 : LABEL io.buildpacks.stack.id=${stack_id}
---> Running in ab67f61be517
Removing intermediate container ab67f61be517
---> e71ce677984b
Step 6/15 : USER root
---> Running in 6f930089c4ac
Removing intermediate container 6f930089c4ac
---> 6e938101a8c0
Step 7/15 : COPY ./nodejs.module /etc/dnf/modules.d
---> 38923ab245b1
Step 8/15 : RUN microdnf install -y nodejs tar
---> Running in ff28f620ca25
(microdnf:1): librhsm-WARNING **: 18:26:45.957: Found 0 entitlement certificates
(microdnf:1): librhsm-WARNING **: 18:26:45.959: Found 0 entitlement certificates
(microdnf:1): libdnf-WARNING **: 18:26:45.960: Loading "/etc/dnf/dnf.conf": IniParser: Can't open file
Downloading metadata...
Downloading metadata...
Downloading metadata...
Package Repository Size
Installing:
nodejs-1:12.18.4-2.module+el8.2.0+8361+192e434e.x86_64 ubi-8-appstream 10.8 MB
nodejs-docs-1:12.18.4-2.module+el8.2.0+8361+192e434e.noarch ubi-8-appstream 4.2 MB
nodejs-full-i18n-1:12.18.4-2.module+el8.2.0+8361+192e434e.x86_64 ubi-8-appstream 7.9 MB
npm-1:6.14.6-1.12.18.4.2.module+el8.2.0+8361+192e434e.x86_64 ubi-8-appstream 4.0 MB
Transaction Summary:
Installing: 4 packages
Reinstalling: 0 packages
Upgrading: 0 packages
Removing: 0 packages
Downgrading: 0 packages
Downloading packages...
Running transaction test...
Installing: nodejs-docs;1:12.18.4-2.module+el8.2.0+8361+192e434e;noarch;ubi-8-appstream
Installing: nodejs-full-i18n;1:12.18.4-2.module+el8.2.0+8361+192e434e;x86_64;ubi-8-appstream
Installing: nodejs;1:12.18.4-2.module+el8.2.0+8361+192e434e;x86_64;ubi-8-appstream
Installing: npm;1:6.14.6-1.12.18.4.2.module+el8.2.0+8361+192e434e;x86_64;ubi-8-appstream
Complete.
Removing intermediate container ff28f620ca25
---> 582ae53d63b4
Step 9/15 : ENV HOME /projects/node-function
---> Running in 0d6337840266
Removing intermediate container 0d6337840266
---> 1b163f85b893
Step 10/15 : WORKDIR $HOME
---> Running in 9d3f1564d045
Removing intermediate container 9d3f1564d045
---> 53de1267160c
Step 11/15 : RUN chown cnb:cnb $HOME
---> Running in d5640a3b3bfc
Removing intermediate container d5640a3b3bfc
---> 239e4bb3d7e8
Step 12/15 : USER cnb
---> Running in de72fe19ad48
Removing intermediate container de72fe19ad48
---> 3222db75b129
Step 13/15 : ENV NODE_PATH $HOME/node_modules
---> Running in fad6b2a3266b
Removing intermediate container fad6b2a3266b
---> bb631bc20d91
Step 14/15 : ENV NODE_ENV production
---> Running in 58133524c296
Removing intermediate container 58133524c296
---> 121b15c9bd75
Step 15/15 : ENV PORT 8080
---> Running in 7dcd92936e90
Removing intermediate container 7dcd92936e90
---> cd393d626d2f
[Warning] One or more build-args [base_image] were not consumed
Successfully built cd393d626d2f
Successfully tagged quay.io/boson/faas-stack-run:nodejs-tip
STACK BUILT!
Stack ID: dev.boson.stacks.nodejs
Images:
quay.io/boson/faas-stack-base:nodejs-tip
quay.io/boson/faas-stack-build:nodejs-tip
quay.io/boson/faas-stack-run:nodejs-tip
That's quiiiite big if the alpine-nodejs image on Dockerhub is just 26meg. Smaller images should make for a quicker push/deploy iteration cycle, even when starting.