Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(flagd): update profile.Dockerfile with buildkit caching #723

Merged

Conversation

tranngoclam
Copy link
Contributor

@tranngoclam tranngoclam commented Jun 29, 2023

This PR

updates flagd/profile.Dockerfile with changes:

  • use less layers (from 7 to 2)
  • leverage buildkit features: cache (go mod, go build) and bind

Related Issues

Notes

Follow-up Tasks

How to test

$ docker build . -f ./flagd/profile.Dockerfile -t flagdprofile        
[+] Building 2.2s (13/13) FINISHED                                                                                                                docker:orbstack
 => [internal] load .dockerignore                                                                                                                            0.0s
 => => transferring context: 2B                                                                                                                              0.0s
 => [internal] load build definition from profile.Dockerfile                                                                                                 0.0s
 => => transferring dockerfile: 1.76kB                                                                                                                       0.0s
 => [internal] load metadata for gcr.io/distroless/static:nonroot                                                                                            0.8s
 => [internal] load metadata for docker.io/library/golang:1.20-alpine                                                                                        2.2s
 => [auth] library/golang:pull token for registry-1.docker.io                                                                                                0.0s
 => [builder 1/4] FROM docker.io/library/golang:1.20-alpine@sha256:fd9d9d7194ec40a9a6ae89fcaef3e47c47de7746dd5848ab5343695dbbd09f8c                          0.0s
 => [stage-1 1/3] FROM gcr.io/distroless/static:nonroot@sha256:9ecc53c269509f63c69a266168e4a687c7eb8c0cfd753bd8bfcaa4f58a90876f                              0.0s
 => [internal] load build context                                                                                                                            0.0s
 => => transferring context: 6.36kB                                                                                                                          0.0s
 => CACHED [builder 2/4] WORKDIR /src                                                                                                                        0.0s
 => CACHED [builder 3/4] RUN --mount=type=cache,target=/go/pkg/mod/     --mount=type=bind,source=./core/go.mod,target=./core/go.mod     --mount=type=bind,s  0.0s
 => CACHED [builder 4/4] RUN --mount=type=cache,target=/go/pkg/mod/     --mount=type=cache,target=/root/.cache/go-build     --mount=type=bind,source=./core  0.0s
 => CACHED [stage-1 2/3] COPY --from=builder /bin/flagd-build .                                                                                              0.0s
 => exporting to image                                                                                                                                       0.0s
 => => exporting layers                                                                                                                                      0.0s
 => => writing image sha256:9c927f091058423d906644febcb182df0db4afa32ef2e1fc1a65d7c947390468                                                                 0.0s
 => => naming to docker.io/library/flagdprofile                                                                                                              0.0s

$ docker run flagdprofile version

                 ______   __       ________   _______    ______      
                /_____/\ /_/\     /_______/\ /______/\  /_____/\     
                \::::_\/_\:\ \    \::: _  \ \\::::__\/__\:::_ \ \    
                 \:\/___/\\:\ \    \::(_)  \ \\:\ /____/\\:\ \ \ \   
                  \:::._\/ \:\ \____\:: __  \ \\:\\_  _\/ \:\ \ \ \  
                   \:\ \    \:\/___/\\:.\ \  \ \\:\_\ \ \  \:\/.:| | 
                    \_\/     \_____\/ \__\/\__\/ \_____\/   \____/_/                                                                                             

@tranngoclam tranngoclam requested a review from a team as a code owner June 29, 2023 10:03
Signed-off-by: Lam Tran <lam.tran@spenmo.com>
@codecov
Copy link

codecov bot commented Jun 29, 2023

Codecov Report

Merging #723 (6facdfe) into main (3e9cc1a) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main     #723   +/-   ##
=======================================
  Coverage   73.68%   73.68%           
=======================================
  Files          26       26           
  Lines        2603     2603           
=======================================
  Hits         1918     1918           
  Misses        612      612           
  Partials       73       73           

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

Copy link
Member

@beeme1mr beeme1mr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

Would you be interested in optimizing the build.Dockerfile as well?

@beeme1mr
Copy link
Member

No idea why Codecov thinks the coverage when down but it can safely be ignored.

@tranngoclam
Copy link
Contributor Author

Looks good, thanks!

Would you be interested in optimizing the build.Dockerfile as well?

Yes, I will give 2 separate PRs for flagd/build.Dockerfile and flagd-proxy/build.Dockerfile

@toddbaert toddbaert self-requested a review July 5, 2023 16:03
@toddbaert toddbaert merged commit 3f263c6 into open-feature:main Jul 5, 2023
11 checks passed
@github-actions github-actions bot mentioned this pull request Jul 5, 2023
beeme1mr pushed a commit that referenced this pull request Jul 14, 2023
🤖 I have created a release *beep* *boop*
---


<details><summary>flagd: 0.6.0</summary>

##
[0.6.0](flagd/v0.5.4...flagd/v0.6.0)
(2023-07-13)

### ⚠ BREAKING CHANGES

* rename metrics and service
([#730](#730))

### 🐛 Bug Fixes

* **deps:** update module github.com/open-feature/flagd/core to v0.5.4
([#693](#693))
([33705a6](33705a6))
* **deps:** update module
github.com/open-feature/go-sdk-contrib/providers/flagd to v0.1.13
([#697](#697))
([435448f](435448f))
* **deps:** update module github.com/spf13/viper to v1.16.0
([#679](#679))
([798a975](798a975))


### 🔄 Refactoring

* **flagd:** update build.Dockerfile with buildkit caching
([#724](#724))
([3e9cc1a](3e9cc1a))
* **flagd:** update profile.Dockerfile with buildkit caching
([#723](#723))
([3f263c6](3f263c6))
* remove protobuf dependency from eval package
([#701](#701))
([34ffafd](34ffafd))
</details>

<details><summary>flagd-proxy: 0.2.5</summary>

##
[0.2.5](flagd-proxy/v0.2.4...flagd-proxy/v0.2.5)
(2023-07-13)


### 🐛 Bug Fixes

* **deps:** update module github.com/open-feature/flagd/core to v0.5.4
([#693](#693))
([33705a6](33705a6))
* **deps:** update module github.com/spf13/viper to v1.16.0
([#679](#679))
([798a975](798a975))


### 🔄 Refactoring

* **flagd-proxy:** update build.Dockerfile with buildkit caching
([#725](#725))
([06f3d2e](06f3d2e))
* remove protobuf dependency from eval package
([#701](#701))
([34ffafd](34ffafd))
</details>

<details><summary>core: 0.6.0</summary>

##
[0.6.0](core/v0.5.4...core/v0.6.0)
(2023-07-13)


### ⚠ BREAKING CHANGES

* rename metrics and service
([#730](#730))

### 🔄 Refactoring

* remove protobuf dependency from eval package
([#701](#701))
([34ffafd](34ffafd))


### 🐛 Bug Fixes

* **deps:** update kubernetes packages to v0.27.3
([#708](#708))
([5bf3a69](5bf3a69))
* **deps:** update module github.com/bufbuild/connect-go to v1.9.0
([#722](#722))
([75223e2](75223e2))
* **deps:** update module github.com/bufbuild/connect-opentelemetry-go
to v0.4.0 ([#739](#739))
([713e2a9](713e2a9))
* **deps:** update module github.com/prometheus/client_golang to v1.16.0
([#709](#709))
([b8bedd2](b8bedd2))
* **deps:** update module golang.org/x/crypto to v0.10.0
([#647](#647))
([7f1d7e6](7f1d7e6))
* **deps:** update module golang.org/x/mod to v0.11.0
([#705](#705))
([42813be](42813be))
* **deps:** update module golang.org/x/mod to v0.12.0
([#729](#729))
([7b109c7](7b109c7))
* **deps:** update module golang.org/x/net to v0.11.0
([#706](#706))
([27d893f](27d893f))
* **deps:** update module golang.org/x/sync to v0.3.0
([#707](#707))
([7852efb](7852efb))
* **deps:** update module google.golang.org/grpc to v1.56.1
([#710](#710))
([8f16573](8f16573))
* **deps:** update module google.golang.org/grpc to v1.56.2
([#738](#738))
([521cc30](521cc30))
* **deps:** update module google.golang.org/protobuf to v1.31.0
([#720](#720))
([247239e](247239e))
* **deps:** update opentelemetry-go monorepo
([#648](#648))
([c12dad8](c12dad8))


### ✨ New Features

* **flagD:** support zero downtime during upgrades
([#731](#731))
([7df8d39](7df8d39))
* rename metrics and service
([#730](#730))
([09c0198](09c0198))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Signed-off-by: Kavindu Dodanduwa <kavindudodanduwa@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Kavindu Dodanduwa <kavindudodanduwa@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants