padok-team / burrito

🌯 Burrito is a TACoS Kubernetes Operator - "ArgoCD for Terraform"
https://padok-team.github.io/burrito
Apache License 2.0
252 stars 10 forks source link

feat(docker): Improve Dockerfile #125

Closed corrieriluca closed 1 year ago

corrieriluca commented 1 year ago

Features

Use fixed versions in FROM statements

Fixes #84.

https://github.com/padok-team/burrito/blob/f2156f542f1e7cdbadb70c2c0b9c64750f35a783/Dockerfile#L2

https://github.com/padok-team/burrito/blob/f2156f542f1e7cdbadb70c2c0b9c64750f35a783/Dockerfile#L36

Note

The SHA256 digests are the ones of the multi-platform image's manifest, obtained with the two followings commands as of May 14th, 2023:

docker buildx imagetools inspect golang:1.19.9
docker buildx imagetools inspect alpine:3.18.0

This enables the Docker image to be built with these fixed versions on any platform supported by the referenced manifests.

Reduce Docker image size

Fixes #124.

By using alpine:3.18.0 instead of golang:alpine, the size decreases from ~390MB to ~96MB.

Adding the --no-cache option reduces the image only by ~1.5MB but is common practice.

Now the final image has a size of ~95MB.

Note

The size described are for the linux/arm64/v8 architecture, I did not tested on linux/amd64, but the gains should be similar.

codecov-commenter commented 1 year ago

Codecov Report

Merging #125 (f2156f5) into main (192ca72) will not change coverage. The diff coverage is n/a.

:exclamation: Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@           Coverage Diff           @@
##             main     #125   +/-   ##
=======================================
  Coverage   45.08%   45.08%           
=======================================
  Files          23       23           
  Lines        1546     1546           
=======================================
  Hits          697      697           
  Misses        822      822           
  Partials       27       27           

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more