Hello, Sankar,

The minimal Docker image for a Go webapp contains absolutely nothing in its 
filesystem other than the binary itself.  Here's an example Dockerfile for 
such an image:
FROM scratch
COPY appname /
EXPOSE 8000
CMD ["/appname"]


However, to build the image, you have to have a full Go compiler toolchain, 
which means you need a full OS distro under it.  This is (relatively) huge. 
 It doesn't have to be in a separate Docker image; it can be run natively 
outside of Docker.  But you can't have the build in the Dockerfile for the 
image you're building, because that would require you to have the full OS 
distro and Go toolchain in that image, and then it wouldn't be small.

Regards,
Steve



On Friday, February 24, 2017 at 7:57:45 AM UTC-8, Sankar wrote:
>
> Hi
>
> I have a bunch of services (all sources in a single git project) which I 
> want to dockerize and deploy in kubernetes (and run CI too preferably via 
> minikube).
>
> I have seen that it is possible to generate small docker images for golang 
> HTTP servers by building them separately outside the Dockerfile that will 
> be used for deployment, such as: 
> http://samuraiprogrammer.net/blog/way-to-reduce-docker-image-size-with-tarball/
>
> But the above approach of two Dockerfiles for each service, makes it very 
> difficult to manage the sources. I wanted to know if there are any 
> hacks/best-practices for reducing the docker image sizes for golang 
> microservices but without creating two Dockerfiles for each service. Any 
> help ?
>
> Thanks.
>
> Sankar
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to