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-proxy): update build.Dockerfile with buildkit caching #725

Merged

Conversation

tranngoclam
Copy link
Contributor

This PR

updates flagd-proxy/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-proxy/build.Dockerfile -t flagd-proxy
[+] Building 19.3s (13/13) FINISHED                                                                                                               docker:orbstack
 => [internal] load build definition from build.Dockerfile                                                                                                   0.0s
 => => transferring dockerfile: 1.99kB                                                                                                                       0.0s
 => [internal] load .dockerignore                                                                                                                            0.0s
 => => transferring context: 2B                                                                                                                              0.0s
 => [internal] load metadata for gcr.io/distroless/static:nonroot                                                                                            0.7s
 => [internal] load metadata for docker.io/library/golang:1.20-alpine                                                                                        2.1s
 => [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
 => CACHED [stage-1 1/3] FROM gcr.io/distroless/static:nonroot@sha256:9ecc53c269509f63c69a266168e4a687c7eb8c0cfd753bd8bfcaa4f58a90876f                       0.0s
 => [internal] load build context                                                                                                                            0.0s
 => => transferring context: 298.78kB                                                                                                                        0.0s
 => CACHED [builder 2/4] WORKDIR /src                                                                                                                        0.0s
 => [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,source=.  0.7s
 => [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  16.2s
 => [stage-1 2/3] COPY --from=builder /bin/flagd-build .                                                                                                     0.0s
 => exporting to image                                                                                                                                       0.1s
 => => exporting layers                                                                                                                                      0.1s
 => => writing image sha256:671b02ae96c27e2a1c3dc336c2a25fd2b1897d7737cb805cb5e0d72c562965b5                                                                 0.0s
 => => naming to docker.io/library/flagd-proxy                                                                                                               0.0s

$ docker run flagd-proxy        

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

flagd-proxy allows flagd to subscribe to CRD changes without the required permissions.

Usage:
  flagd [command]

Available Commands:
  completion  Generate the autocompletion script for the specified shell
  help        Help about any command
  start       Start flagd-proxy

Flags:
      --config string   config file (default is $HOME/.agent.yaml)
  -x, --debug           verbose logging
  -h, --help            help for flagd

Use "flagd [command] --help" for more information about a command.

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:31
@codecov
Copy link

codecov bot commented Jun 30, 2023

Codecov Report

Merging #725 (8a2ec9d) into main (7b109c7) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main     #725   +/-   ##
=======================================
  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 merged commit 06f3d2e into open-feature:main Jul 5, 2023
@github-actions github-actions bot mentioned this pull request Jul 4, 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