Skip to content

Commit

Permalink
Dockerfile update to use Go as builder (#12006)
Browse files Browse the repository at this point in the history
* Removal of ko, image-autobumper

* Pull build action

* fix typo

* more typos

* test of dockerfile on PR
  • Loading branch information
akiioto authored Sep 27, 2024
1 parent cc8c545 commit bc42bcd
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions cmd/image-autobumper/Dockerfile
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"]

0 comments on commit bc42bcd

Please sign in to comment.