Skip to content

Commit

Permalink
chore: use GOCACHE in skaffold (Kong/gateway-operator-archive#1554)
Browse files Browse the repository at this point in the history
  • Loading branch information
pmalek authored Mar 5, 2024
1 parent 67ce2b9 commit a69672e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ ARG GOCACHE
# layers when using COPY instructions for go.mod and go.sum.
# https://docs.docker.com/build/guide/mounts/
RUN --mount=type=cache,target=$GOPATH/pkg/mod \
--mount=type=cache,target=$GOCACHE \
--mount=type=bind,source=go.sum,target=go.sum \
--mount=type=bind,source=go.mod,target=go.mod \
go mod download -x
Expand Down Expand Up @@ -41,6 +42,7 @@ RUN printf "Building for TARGETPLATFORM=${TARGETPLATFORM}" \
# layers when using COPY instructions for go.mod and go.sum.
# https://docs.docker.com/build/guide/mounts/
RUN --mount=type=cache,target=$GOPATH/pkg/mod \
--mount=type=cache,target=$GOCACHE \
--mount=type=bind,source=go.sum,target=go.sum \
--mount=type=bind,source=go.mod,target=go.mod \
CGO_ENABLED=0 GOOS=linux GOARCH="${TARGETARCH}" \
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,8 @@ SKAFFOLD_RUN_PROFILE ?= dev

.PHONY: _skaffold
_skaffold: skaffold
$(SKAFFOLD) $(CMD) --port-forward=pods --profile=$(SKAFFOLD_PROFILE) $(SKAFFOLD_FLAGS)
GOCACHE=$(shell go env GOCACHE) \
$(SKAFFOLD) $(CMD) --port-forward=pods --profile=$(SKAFFOLD_PROFILE) $(SKAFFOLD_FLAGS)

.PHONY: run.skaffold
run.skaffold:
Expand Down
3 changes: 3 additions & 0 deletions skaffold.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ profiles:
TAG: "{{ .TAG }}"
COMMIT: "{{ .COMMIT }}"
REPO_INFO: "{{ .REPO_INFO }}"
GOCACHE: "{{ .GOCACHE }}"
- name: dev
manifests:
kustomize:
Expand All @@ -57,6 +58,7 @@ profiles:
TAG: "{{ .TAG }}"
COMMIT: "{{ .COMMIT }}"
REPO_INFO: "{{ .REPO_INFO }}"
GOCACHE: "{{ .GOCACHE }}"
- name: debug
manifests:
kustomize:
Expand All @@ -78,3 +80,4 @@ profiles:
TAG: "{{ .TAG }}"
COMMIT: "{{ .COMMIT }}"
REPO_INFO: "{{ .REPO_INFO }}"
GOCACHE: "{{ .GOCACHE }}"

0 comments on commit a69672e

Please sign in to comment.