Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit f8e4723

Browse files
Fix missing TARGETOS and TARGETARCH in Dockerfile
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
1 parent ea07e60 commit f8e4723

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

Dockerfile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ARG GOLANGCI_LINT_VERSION=v1.27.0-alpine
77
####
88
# BUILDER
99
####
10-
FROM golang:${GO_VERSION} AS builder
10+
FROM --platform=${BUILDPLATFORM} golang:${GO_VERSION} AS builder
1111
WORKDIR /go/src/github.com/docker/docker-scan
1212

1313
# cache go vendoring
@@ -36,8 +36,11 @@ RUN --mount=target=. \
3636
# BUILD
3737
####
3838
FROM builder AS build
39-
RUN --mount=target=. \
40-
--mount=type=cache,target=/root/.cache/go-build \
39+
ARG TARGETOS
40+
ARG TARGETARCH
41+
RUN --mount=type=cache,target=/root/.cache/go-build \
42+
GOOS=${TARGETOS} \
43+
GOARCH=${TARGETARCH} \
4144
make -f builder.Makefile build
4245

4346
####

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ BUILD_ARGS := --build-arg SNYK_DESKTOP_VERSION=$(SNYK_DESKTOP_VERSION)\
1919
build: ## Build docker-scan in a container
2020
docker build $(BUILD_ARGS) . \
2121
--output type=local,dest=./bin \
22+
--platform local \
2223
--target scan
2324

2425
.PHONY: cross

0 commit comments

Comments
 (0)