diff --git a/Dockerfile b/Dockerfile index 9c41688767..e4f408dc0b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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. @@ -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" @@ -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"] diff --git a/Makefile b/Makefile index fb46c41184..1dddbf1e37 100644 --- a/Makefile +++ b/Makefile @@ -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