Yes, I wasn't saying it was impossible, just that it's not entirely within our gift.
I would really like to see
- swift:5.0-slim (base on Ubuntu)
Wow I'm coming late to this thread. @IanPartridge this is fantastic! I've been wanting this and I know others have been asking me this for a while now!
I've got a PR up with prototype slim Dockerfiles for Swift 5.0.1. Please take a look and try them out!
The slim images are working for us (Kitura) in our testing, so I've merged them to
master. They are not available on Docker Hub yet as I suggest we make them generally available alongside the next Swift release.
Please do try them out and post your experience. I'm particularly interested to check they work for Vapor.
Super awesome @IanPartridge! I'll give them a spin for sure. Out of curiosity, do you already have size comparison between the normal & slim images?
Full bionic (18.04): 1.35GB
Slim bionic (18.04): 226MB
Full xenial (16.04): 1.37GB
Slim xenial (16.04): 249MB
Woah! I expected improvements, but that's just mindblowing! Very nice work on this!
Very nice job, but I think it can be smaller. I tried to compile Swift on Alpine, but got many errors and stop doing this, but I think Alpine would be the smallest base image for "cloud-native" Swift.
We implemented something similar to this: https://medium.com/@jjacobson/a-minimal-swift-docker-image-b93d2bc1ce3c, in which we basically start from a slimed down version of Ubuntu (abt 50MB) and add just the libraries the compiled Swift program links to. We are able to get images in the range of 150MB including our own code (NIO based server stuff).
Earlier, we had issues with Alpine Linux not being able to resolve hostname to ip from inside the container (see https://github.com/gliderlabs/docker-alpine/issues/8 which was not really resolved as of late last year). We haven't tried Alpine since.