From 58a8e79d5c25873a9b68c23688a9f94a3c21a9d2 Mon Sep 17 00:00:00 2001
From: Pavol Loffay
Date: Tue, 24 May 2022 09:33:48 +0200
Subject: [PATCH] Fix docker multiarch build for operator (#882)
* Fix docker multiarch build for operator
Signed-off-by: Pavol Loffay
* Fix docker multiarch build for operator
Signed-off-by: Pavol Loffay
* Fix multiarch build for TA
Signed-off-by: Pavol Loffay
---
Dockerfile | 3 +--
cmd/otel-allocator/Dockerfile | 4 +---
2 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/Dockerfile b/Dockerfile
index 501565fefc..a38643660e 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -17,7 +17,6 @@ COPY internal/ internal/
COPY pkg/ pkg/
COPY versions.txt versions.txt
-ARG TARGETARCH=amd64
ARG VERSION_PKG
ARG VERSION
ARG VERSION_DATE
@@ -28,7 +27,7 @@ ARG AUTO_INSTRUMENTATION_NODEJS_VERSION
ARG AUTO_INSTRUMENTATION_PYTHON_VERSION
# Build
-RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} GO111MODULE=on go build -ldflags="-X ${VERSION_PKG}.version=${VERSION} -X ${VERSION_PKG}.buildDate=${VERSION_DATE} -X ${VERSION_PKG}.otelCol=${OTELCOL_VERSION} -X ${VERSION_PKG}.targetAllocator=${TARGETALLOCATOR_VERSION} -X ${VERSION_PKG}.autoInstrumentationJava=${AUTO_INSTRUMENTATION_JAVA_VERSION} -X ${VERSION_PKG}.autoInstrumentationNodeJS=${AUTO_INSTRUMENTATION_NODEJS_VERSION} -X ${VERSION_PKG}.autoInstrumentationPython=${AUTO_INSTRUMENTATION_PYTHON_VERSION}" -a -o manager main.go
+RUN CGO_ENABLED=0 GOOS=linux GO111MODULE=on go build -ldflags="-X ${VERSION_PKG}.version=${VERSION} -X ${VERSION_PKG}.buildDate=${VERSION_DATE} -X ${VERSION_PKG}.otelCol=${OTELCOL_VERSION} -X ${VERSION_PKG}.targetAllocator=${TARGETALLOCATOR_VERSION} -X ${VERSION_PKG}.autoInstrumentationJava=${AUTO_INSTRUMENTATION_JAVA_VERSION} -X ${VERSION_PKG}.autoInstrumentationNodeJS=${AUTO_INSTRUMENTATION_NODEJS_VERSION} -X ${VERSION_PKG}.autoInstrumentationPython=${AUTO_INSTRUMENTATION_PYTHON_VERSION}" -a -o manager main.go
# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
diff --git a/cmd/otel-allocator/Dockerfile b/cmd/otel-allocator/Dockerfile
index 3179bf22c5..6f88d650a5 100644
--- a/cmd/otel-allocator/Dockerfile
+++ b/cmd/otel-allocator/Dockerfile
@@ -1,8 +1,6 @@
# Build the target allocator binary
FROM golang:1.18 as builder
-ARG TARGETARCH=amd64
-
WORKDIR /app
# Copy go mod and sum files
@@ -13,7 +11,7 @@ RUN go mod download
COPY . .
# Build the Go app
-RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} go build -a -installsuffix cgo -o main .
+RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main .
######## Start a new stage from scratch #######
FROM alpine:latest