diff --git a/Dockerfile b/Dockerfile index 194091a51..303ce963f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,30 +1,26 @@ ARG ENABLE_PROXY=false ARG BASE_IMAGE_TAG=nonroot -ARG ADC_VERSION=0.17.0 -ARG TARGETARCH -FROM golang:1.22 AS builder +FROM debian:bullseye-slim AS deps WORKDIR /workspace -COPY go.* ./ - -RUN if [ "$ENABLE_PROXY" = "true" ] ; then go env -w GOPROXY=https://goproxy.cn,direct ; fi \ - && go mod download -COPY . . - -RUN --mount=type=cache,target=/root/.cache/go-build make build && mv bin/api7-ingress-controller /bin && rm -rf /workspace +ARG ADC_VERSION=0.18.0 +ARG TARGETARCH -RUN wget https://github.com/api7/adc/releases/download/v${ADC_VERSION}/adc-v${ADC_VERSION}-linux-${TARGETARCH}.tar.gz \ - && tar -zxvf adc-v${ADC_VERSION}-linux-${TARGETARCH}.tar.gz \ - && mv adc-v${ADC_VERSION}-linux-${TARGETARCH}/adc /bin \ - && rm -rf adc-v${ADC_VERSION}-linux-${TARGETARCH}.tar.gz adc-v${ADC_VERSION}-linux-${TARGETARCH} +RUN apt update \ + && apt install -y wget \ + && wget https://github.com/api7/adc/releases/download/v${ADC_VERSION}/adc_${ADC_VERSION}_linux_${TARGETARCH}.tar.gz -O adc.tar.gz \ + && tar -zxvf adc.tar.gz \ + && mv adc /bin/adc \ + && rm -rf adc.tar.gz \ + && apt autoremove -y wget -FROM gcr.io/distroless/static-debian12:${BASE_IMAGE_TAG} +FROM gcr.io/distroless/cc-debian12:${BASE_IMAGE_TAG} WORKDIR /app -COPY --from=builder /bin/api7-ingress-controller . -COPY --from=builder /bin/adc /bin/adc -COPY config/samples/config.yaml ./conf/config.yaml +COPY --from=deps /bin/adc /bin/adc +COPY ./bin/api7-ingress-controller . +COPY ./config/samples/config.yaml ./conf/config.yaml ENTRYPOINT ["/app/api7-ingress-controller"] CMD ["-c", "/app/conf/config.yaml"] diff --git a/Makefile b/Makefile index 02ded7125..45032f5ce 100644 --- a/Makefile +++ b/Makefile @@ -159,7 +159,7 @@ run: manifests generate fmt vet ## Run a controller from your host. # More info: https://docs.docker.com/develop/develop-images/build_enhancements/ .PHONY: docker-build docker-build: build ## Build docker image with the manager. - $(CONTAINER_TOOL) build -t ${IMG} -f Dockerfile.dev . + $(CONTAINER_TOOL) build -t ${IMG} -f Dockerfile . .PHONY: docker-push docker-push: ## Push docker image with the manager.