Smallest possible image

I’m curious how to make the smallest possible valid image for a raspberry pizero. I tried the following in my docker template:

FROM balenalib/%%BALENA_MACHINE_NAME%%-alpine:run
CMD while true; do sleep 10000; done

but that still came to 72MB

Hi, the smallest possible image for which use-case? If you’re looking to deploy an app that can be compiled and is stand-alone, you can leverage multi-stage dockerfiles to compile a static-binary in one stage and then do something like:

FROM balenalib/%%BALENA_MACHINE_NAME%%-alpine AS build
RUN ...

FROM scratch
COPY --from=build /output/app /bin/app
CMD [ "/bin/app" ]

That gets you an image with only your binary in it.

if you’re looking for something more complex. You can take any container image that supports the pi zero, for example the official alpine image: https://hub.docker.com/r/arm32v6/alpine which might be smaller

We’re working on supporting the official dockerhub images like https://hub.docker.com/_/alpine which in the future will allow you to base your builds on them directly instead of the platform specific ones

@robertgzr I took the alpine image which is 3.5MB so much smaller.