-
Notifications
You must be signed in to change notification settings - Fork 94
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
Base images are HUGE. #19
Comments
An Alpine-based image is blocked on an official MUSL toolchain, which is tracked in #10. The base image we use is buildpack-deps, which includes a bunch of common build tools and C libraries. This mirrors what other similar images to, like gcc and python. It looks like the python image also publishes a slim variant based off of |
This should be a pretty minimal setup: FROM debian:stretch-slim
ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends \
ca-certificates \
gcc \
libc6-dev \
wget \
; \
\
# this "case" statement is generated via "update.sh"
dpkgArch="$(dpkg --print-architecture)"; \
case "${dpkgArch##*-}" in \
amd64) rustArch='x86_64-unknown-linux-gnu'; rustupSha256='c9837990bce0faab4f6f52604311a19bb8d2cde989bea6a7b605c8e526db6f02' ;; \
armhf) rustArch='armv7-unknown-linux-gnueabihf'; rustupSha256='297661e121048db3906f8c964999f765b4f6848632c0c2cfb6a1e93d99440732' ;; \
arm64) rustArch='aarch64-unknown-linux-gnu'; rustupSha256='a68ac2d400409f485cb22756f0b3217b95449884e1ea6fd9b70522b3c0a929b2' ;; \
i386) rustArch='i686-unknown-linux-gnu'; rustupSha256='27e6109c7b537b92a6c2d45ac941d959606ca26ec501d86085d651892a55d849' ;; \
*) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \
esac; \
\
url="https://static.rust-lang.org/rustup/archive/1.11.0/${rustArch}/rustup-init"; \
wget "$url"; \
echo "${rustupSha256} *rustup-init" | sha256sum -c -; \
chmod +x rustup-init; \
./rustup-init -y --no-modify-path --default-toolchain 1.24.0; \
rm rustup-init; \
chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \
rustup --version; \
cargo --version; \
rustc --version; \
\
apt-get remove -y --auto-remove \
wget \
; \
rm -rf /var/lib/apt/lists/*; |
I'm only including stretch - I think we'll hopefully be removing the jessie images entirely in 1.26 but there's no reason to create them for these new images in the first place. Closes #19
It would be awesome to get an alpine (not sure if we are still blocked on musl) version of an image built, as that could drastically reduce base image size (currently around 477MiB compressed). The build pack base image is around 250MiB compressed, whereas alpine base image is about 2MiB compressed. Currently, the build here is nearly doubling the size of the image.
If that is not possible right now, it would be beneficial to strip out as much bloat from the base image as possible. I've only looked over the dockerfiles briefly, and I would have to investigate further to really see what could be stripped out, to find where the bloat may be coming from.
Thoughts?
The text was updated successfully, but these errors were encountered: