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

chore: use docker buildkit to cache go build cache #1778

Merged
merged 1 commit into from
Apr 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#
#syntax=docker/dockerfile:1.2

# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
Expand Down Expand Up @@ -30,7 +31,7 @@ RUN if [ "$ENABLE_PROXY" = "true" ] ; then go env -w GOPROXY=https://goproxy.cn,
&& go mod download

COPY . .
RUN make build
RUN --mount=type=cache,target=/root/.cache/go-build make build

FROM centos:centos7
LABEL maintainer="gxthrj@163.com"
Expand All @@ -40,7 +41,7 @@ RUN yum -y install ca-certificates libc6-compat \
&& update-ca-trust \
&& echo "hosts: files dns" > /etc/nsswitch.conf

COPY --from=build-env /build/apisix-ingress-controller .
COPY --from=build-env /usr/share/zoneinfo/Hongkong /etc/localtime
COPY --from=build-env /build/apisix-ingress-controller .

ENTRYPOINT ["/ingress-apisix/apisix-ingress-controller", "ingress", "--config-path", "/ingress-apisix/conf/config.yaml"]
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ clean-image: ## Removes local image
.PHONY: build-image
build-image:
ifeq ($(E2E_SKIP_BUILD), 0)
docker build -t apache/apisix-ingress-controller:$(IMAGE_TAG) --build-arg ENABLE_PROXY=$(ENABLE_PROXY) .
DOCKER_BUILDKIT=1 docker build -t apache/apisix-ingress-controller:$(IMAGE_TAG) --build-arg ENABLE_PROXY=$(ENABLE_PROXY) .
docker tag apache/apisix-ingress-controller:$(IMAGE_TAG) $(REGISTRY)/apisix-ingress-controller:$(IMAGE_TAG)
endif

Expand Down