decred / dcrd

Decred daemon in Go (golang).

Home Page:https://decred.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use distroless docker containers

naveensrinivasan opened this issue · comments

Using distroless https://github.com/GoogleContainerTools/distroless docker containers is recommended approach in increasing the security posture.

Restricting what's in your runtime container to precisely what's necessary for your app is a best practice employed by Google and other tech giants that have used containers in production for many years. It improves the signal to noise of scanners (e.g. CVE) and reduces the burden of establishing provenance to just what you need.

Distroless images are very small. The smallest distroless image, gcr.io/distroless/static, is around 650 kB. That's about 25% of the size of alpine (~2.5 MB), and less than 1.5% of the size of debian (50 MB).

For example, gcr.io/distroless/static is a container image that's much smaller than this image of a shipping container. It's about 1/3rd the size of all the resources on this page you're reading right now. It's very small.

Here is an example how distroless can be used along with the standard go application https://github.com/ossf/scorecard/blob/main/Dockerfile

I already have some local work that does this which is mostly done that I was planning on finalizing after the next release when I have a bit more free time to finish it up.

I can also take it up.

Cool. If you'll give me a day or two, I can get a draft PR up that has everything working (and tested) already via a multi-stage build where the final image is distroless (based on scratch) and is right around 10.5MiB. What isn't finished is some of the documentation as well as some final decisions regarding the configuration aspects.

Then if you want to run the ball on finishing up those final tidbits, that would be helpful.

I pushed PR #2740 which is probably 90-95% of this. As previously mentioned, there are some remaining TODOs as far as documentation and a couple of questions in the Dockerfile to be decided on.

It should serve as an excellent base to finish this work up.

I believe this can be closed

I left it open for tracking purposes because there are still some of the aforementioned TODOs outstanding.