Skip to content
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
32 changes: 14 additions & 18 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Loading