Skip to content

Commit

Permalink
use buildx to speedup arm builds
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias Bertschy <matthias.bertschy@gmail.com>
  • Loading branch information
matthyx committed Jul 13, 2023
1 parent c485b8f commit cee07e6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
FROM golang:1.20-alpine as builder
FROM --platform=$BUILDPLATFORM golang:1.20-alpine as builder

ENV GO111MODULE=on CGO_ENABLED=0
WORKDIR /work
ARG TARGETOS TARGETARCH

ADD go.mod go.sum /work/
RUN go mod download

ADD . .
RUN go build -o build/kubevuln cmd/http/main.go
RUN --mount=target=. \
--mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg \
GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o /out/kubevuln cmd/http/main.go

FROM alpine

RUN addgroup -S ks && adduser -S ks -G ks
USER ks
WORKDIR /home/ks/

COPY --from=builder /work/build/kubevuln /usr/bin/kubevuln
COPY --from=builder /out/kubevuln /usr/bin/kubevuln

ARG image_version
ENV RELEASE=$image_version
Expand Down
4 changes: 2 additions & 2 deletions build/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ git clone https://github.com/kubescape/kubevuln.git kubevuln && cd "$_"

2. Build
```
docker build -t kubevuln -f build/Dockerfile .
```
docker buildx build -t kubevuln -f build/Dockerfile --load .
```

0 comments on commit cee07e6

Please sign in to comment.