Skip to content

Commit

Permalink
chore: support secrets-go Dockerfile multiple architecture
Browse files Browse the repository at this point in the history
Signed-off-by: kahirokunn <[email protected]>
  • Loading branch information
kahirokunn committed Aug 21, 2023
1 parent 66ac14a commit 5442985
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion code-samples/serving/secrets-go/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@
# https://hub.docker.com/_/golang
FROM golang as builder

ARG TARGETOS
ARG TARGETARCH

# Copy local code to the container image.
WORKDIR /go/src/github.com/knative/docs/hellosecrets
COPY . .

# Build the output command inside the container.
RUN CGO_ENABLED=0 GOOS=linux go build -v -o hellosecrets
RUN CGO_ENABLED=0 GOOS=linux GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -v -o hellosecrets

# Use a Docker multi-stage build to create a lean production image.
# https://docs.docker.com/develop/develop-images/multistage-build/#use-multi-stage-builds
Expand Down
5 changes: 4 additions & 1 deletion code-samples/serving/secrets-go/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,15 @@ cd knative-docs/code-samples/serving/secrets-go
# https://hub.docker.com/_/golang
FROM golang as builder
ARG TARGETOS
ARG TARGETARCH
# Copy local code to the container image.
WORKDIR /go/src/github.com/knative/docs/hellosecrets
COPY . .
# Build the output command inside the container.
RUN CGO_ENABLED=0 GOOS=linux go build -v -o hellosecrets
RUN CGO_ENABLED=0 GOOS=linux GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -v -o hellosecrets
# Use a Docker multi-stage build to create a lean production image.
# https://docs.docker.com/develop/develop-images/multistage-build/#use-multi-stage-builds
Expand Down

0 comments on commit 5442985

Please sign in to comment.