-
Notifications
You must be signed in to change notification settings - Fork 14
Conversation
Comparing image sizes. Before:
And after:
|
Codecov Report
@@ Coverage Diff @@
## main #868 +/- ##
===========================================
- Coverage 59.12% 35.87% -23.26%
===========================================
Files 35 10 -25
Lines 6679 931 -5748
===========================================
- Hits 3949 334 -3615
+ Misses 2678 559 -2119
+ Partials 52 38 -14
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report at Codecov.
|
|
||
# Build a minimal container from Alpine containing only the stripped binary and | ||
# no intermediate build artifacts | ||
FROM alpine:3.14 |
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.
I believe once openssl is removed we can build from scratch
?
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.
I don't think so, because we still need libc
and a few other .sos for facilitator:
> ldd target/debug/facilitator
linux-vdso.so.1 (0x00007fff9ab7f000)
libssl.so.1.1 => /lib64/libssl.so.1.1 (0x00007f9515fea000)
libcrypto.so.1.1 => /lib64/libcrypto.so.1.1 (0x00007f9515cfc000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f9515ce1000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f9515cc0000)
libm.so.6 => /lib64/libm.so.6 (0x00007f9515b7c000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f9515b75000)
libc.so.6 => /lib64/libc.so.6 (0x00007f95159a4000)
/lib64/ld-linux-x86-64.so.2 (0x00007f951821e000)
libz.so.1 => /lib64/libz.so.1 (0x00007f951598a000)
The libssl
dependency should go away but the rest are still real.
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.
Nit, but good!
facilitator/Dockerfile
Outdated
# no intermediate build artifacts | ||
FROM alpine:3.14 | ||
|
||
Run apk add libgcc && apk update |
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.
Run apk add libgcc && apk update | |
RUN apk add libgcc && apk update |
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.
I didn't realize that all-caps for directives was optional in Dockerfiles, and I'm a little disappointed.
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 the COPY --from
, by default WORKDIR is /
, so it looks like the facilitator
binary lands in the same place, but less explicitly. Anyway, looks good!
Good catch. I changed this so that the destination path is absolute. |
This commit restores some of the changes from #737 in order to emit smaller container images. - build `facilitator` with release profile - build binary in a builder container based on `rust:alpine`, then ship a smaller image based on `alpine` containing just the statically linked binary We can't remove the OpenSSL dependency until kube-rs/kube-rs/597 is released, but this change takes our image size down to ~30 MB from >2 GB. Related to #451
6b7affd
to
1ebc372
Compare
This commit restores some of the changes from #737 in order to emit
smaller container images.
facilitator
with release profilerust:alpine
, then shipa smaller image based on
alpine
containing just the staticallylinked binary
We can't remove the OpenSSL dependency until kube-rs/kube-rs/597 is
released, but this change takes our image size down to ~30 MB from >2
GB.
Related to #451