forked from open-telemetry/opentelemetry-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build ta on the host and copy it into the container image (open-telem…
- Loading branch information
Showing
3 changed files
with
34 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,19 @@ | ||
# Build the otel-allocator binary | ||
FROM golang:1.21-alpine as builder | ||
|
||
WORKDIR /app | ||
# Get CA certificates from the Alpine package repo | ||
FROM alpine:3.18 as certificates | ||
|
||
RUN apk --no-cache add ca-certificates | ||
|
||
# Copy go mod and sum files | ||
COPY go.mod go.sum ./ | ||
|
||
RUN go mod download | ||
|
||
COPY . . | ||
|
||
# Build the Go app | ||
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main . | ||
|
||
######## Start a new stage from scratch ####### | ||
# Start a new stage from scratch | ||
FROM scratch | ||
|
||
ARG TARGETARCH | ||
|
||
WORKDIR /root/ | ||
|
||
# Copy the certs from the builder | ||
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt | ||
# Copy the certs | ||
COPY --from=certificates /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt | ||
|
||
# Copy the pre-built binary file from the previous stage | ||
COPY --from=builder /app/main . | ||
# Copy binary built on the host | ||
COPY bin/targetallocator_${TARGETARCH} ./main | ||
|
||
ENTRYPOINT ["./main"] |