From 15f8dac6d09cc9a8eaa540960288d44de9466604 Mon Sep 17 00:00:00 2001 From: dprotaso Date: Tue, 9 May 2023 11:52:12 -0400 Subject: [PATCH] create autoscale-go image --- ...ve-mkdocs-dockerimage.yaml => knative-docs-image.yaml} | 8 ++++++++ docs/serving/autoscaling/autoscale-go/Dockerfile | 8 ++++++-- docs/serving/autoscaling/autoscale-go/go.mod | 3 +++ 3 files changed, 17 insertions(+), 2 deletions(-) rename .github/workflows/{knative-mkdocs-dockerimage.yaml => knative-docs-image.yaml} (79%) create mode 100644 docs/serving/autoscaling/autoscale-go/go.mod diff --git a/.github/workflows/knative-mkdocs-dockerimage.yaml b/.github/workflows/knative-docs-image.yaml similarity index 79% rename from .github/workflows/knative-mkdocs-dockerimage.yaml rename to .github/workflows/knative-docs-image.yaml index f0cd75ebcc3..3eb74a3fab7 100644 --- a/.github/workflows/knative-mkdocs-dockerimage.yaml +++ b/.github/workflows/knative-docs-image.yaml @@ -39,3 +39,11 @@ jobs: platforms: linux/amd64,linux/arm64 context: ./code-samples/serving/hello-world/helloworld-go tags: ghcr.io/knative/helloworld-go:latest + + - name: Build autoscale-go image + uses: docker/build-push-action@v4 + with: + push: false + platforms: linux/amd64,linux/arm64 + context: ./docs/serving/autoscaling/autoscale-go + tags: ghcr.io/knative/autoscale-go:latest diff --git a/docs/serving/autoscaling/autoscale-go/Dockerfile b/docs/serving/autoscaling/autoscale-go/Dockerfile index 1511fc707ee..dd605efc6d1 100644 --- a/docs/serving/autoscaling/autoscale-go/Dockerfile +++ b/docs/serving/autoscaling/autoscale-go/Dockerfile @@ -14,10 +14,14 @@ FROM golang AS builder +ARG TARGETOS +ARG TARGETARCH + WORKDIR /go/src/app COPY . /go/src/app -RUN CGO_ENABLED=0 go build -o /bin/autoscale-go . -RUN CGO_ENABLED=0 go build -o /bin/load-generator ./test + +RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -o /bin/autoscale-go . +RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -o /bin/load-generator ./test FROM gcr.io/distroless/base EXPOSE 8080 diff --git a/docs/serving/autoscaling/autoscale-go/go.mod b/docs/serving/autoscaling/autoscale-go/go.mod new file mode 100644 index 00000000000..0a23c493ee5 --- /dev/null +++ b/docs/serving/autoscaling/autoscale-go/go.mod @@ -0,0 +1,3 @@ +module autoscale-go + +go 1.20