DEV Community

Discussion on: Dockerize your Go app

Collapse
 
yoursunny profile image
Junxiao Shi

ENV CGO_ENABLED 0 is very important.
If it's forgotten, the program won't start.

Alpine and ca-certificates could be avoided if you mount /etc/ssl/certs directory from the host system.

Collapse
 
karanpratapsingh profile image
Karan Pratap Singh

Agreed! however as the production stage would be built on CI, I don't think it we would want to mount the /etc/ssl/certs host system

Collapse
 
yoursunny profile image
Junxiao Shi

/etc/ssl/certs isn't necessary when you build the production container image. It can be mounted when you run the container in production.

Thread Thread
 
karanpratapsingh profile image
Karan Pratap Singh

sure, but why? I'm trying to understand why will I mount it when it's running on kubernetes?

Thread Thread
 
yoursunny profile image
Junxiao Shi

It's a trade-off between fewer dependency on the host (by including ca-certificates in the image) and smaller image size (by excluding ca-certificates in the image).