-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dockerfile update to use Go as builder (#12006)
* Removal of ko, image-autobumper * Pull build action * fix typo * more typos * test of dockerfile on PR
- Loading branch information
Showing
1 changed file
with
17 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,27 @@ | ||
FROM europe-docker.pkg.dev/kyma-project/prod/testimages/alpine-git:v20240924-6fb36f45 | ||
FROM golang:1.23-alpine as builder | ||
|
||
WORKDIR /app | ||
|
||
COPY go.mod go.sum ./ | ||
|
||
# Download all dependencies. Dependencies will be cached if the go.mod and go.sum files are not changed | ||
RUN go mod download | ||
|
||
# Copy the source to the Working Directory inside the container | ||
COPY . . | ||
|
||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o image-autobumper ./cmd/image-autobumper | ||
WORKDIR /app/cmd/image-autobumper | ||
|
||
ENTRYPOINT ["./image-autobumper"] | ||
# Build the Go app with static linking | ||
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main . | ||
|
||
FROM alpine:3.20.3 | ||
|
||
LABEL io.kyma-project.source=github.com/kyma-project/test-infra/cmd/image-autobumper | ||
|
||
# Copy the built Go app from the builder stage | ||
COPY --from=builder /app/cmd/image-autobumper/main /image-autobumper | ||
|
||
RUN apk add --no-cache ca-certificates git && \ | ||
chmod +x /image-autobumper | ||
ENTRYPOINT ["/image-autobumper"] |