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 build.Dockerfile with buildkit caching #724

Merged

Conversation

tranngoclam
Copy link
Contributor

This PR

updates flagd/build.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/build.Dockerfile -t flagd
[+] Building 17.3s (12/12) FINISHED                                                                                                               docker:orbstack
 => [internal] load .dockerignore                                                                                                                            0.0s
 => => transferring context: 2B                                                                                                                              0.0s
 => [internal] load build definition from build.Dockerfile                                                                                                   0.0s
 => => transferring dockerfile: 1.74kB                                                                                                                       0.0s
 => [internal] load metadata for gcr.io/distroless/static:nonroot                                                                                            0.5s
 => [internal] load metadata for docker.io/library/golang:1.20-alpine                                                                                        1.2s
 => [builder 1/4] FROM docker.io/library/golang:1.20-alpine@sha256:fd9d9d7194ec40a9a6ae89fcaef3e47c47de7746dd5848ab5343695dbbd09f8c                          0.0s
 => [internal] load build context                                                                                                                            0.0s
 => => transferring context: 8.07kB                                                                                                                          0.0s
 => CACHED [stage-1 1/3] FROM gcr.io/distroless/static:nonroot@sha256:9ecc53c269509f63c69a266168e4a687c7eb8c0cfd753bd8bfcaa4f58a90876f                       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
 => [builder 4/4] RUN --mount=type=cache,target=/go/pkg/mod/     --mount=type=cache,target=/root/.cache/go-build     --mount=type=bind,source=./core,targe  15.9s
 => [stage-1 2/3] COPY --from=builder /bin/flagd-build .                                                                                                     0.0s
 => exporting to image                                                                                                                                       0.1s
 => => exporting layers                                                                                                                                      0.1s
 => => writing image sha256:ccfeaee26cdeb83fcdd70408d372f9dc382d028eb53773f062f079bdb6ff4a40                                                                 0.0s
 => => naming to docker.io/library/flagd                                                                                                                     0.0s

$ docker run flagd version

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

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

codecov bot commented Jun 30, 2023

Codecov Report

Merging #724 (3fd4d2e) into main (06f3d2e) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main     #724   +/-   ##
=======================================
  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

@toddbaert toddbaert self-requested a review July 5, 2023 15:49
@toddbaert
Copy link
Member

@tranngoclam thanks for this change!

@toddbaert toddbaert merged commit 3e9cc1a 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.

3 participants