Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(flagd): update profile.Dockerfile with buildkit caching (#723)
<!-- Please use this template for your pull request. --> <!-- Please use the sections that you need and delete other sections --> ## This PR <!-- add the description of the PR here --> 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 <!-- add here the GitHub issue that this PR resolves if applicable --> ### Notes <!-- any additional notes for this PR --> - This change is motivated from the new command of docker: `docker init` (reference: https://docs.docker.com/engine/reference/commandline/init/#example-of-selecting-go) ### Follow-up Tasks <!-- anything that is related to this PR but not done here should be noted under this section --> <!-- if there is a need for a new issue, please link it here --> ### How to test <!-- if applicable, add testing instructions under this section --> ``` $ 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 ______ __ ________ _______ ______ /_____/\ /_/\ /_______/\ /______/\ /_____/\ \::::_\/_\:\ \ \::: _ \ \\::::__\/__\:::_ \ \ \:\/___/\\:\ \ \::(_) \ \\:\ /____/\\:\ \ \ \ \:::._\/ \:\ \____\:: __ \ \\:\\_ _\/ \:\ \ \ \ \:\ \ \:\/___/\\:.\ \ \ \\:\_\ \ \ \:\/.:| | \_\/ \_____\/ \__\/\__\/ \_____\/ \____/_/ ``` Signed-off-by: Lam Tran <lam.tran@spenmo.com> Co-authored-by: Lam Tran <lam.tran@spenmo.com> Co-authored-by: Todd Baert <toddbaert@gmail.com>
- Loading branch information