-
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.
Move building image-detector to github workflow (#11996)
* Move building image-detector to github workflow * Cleanup go mod * Add building the image
- Loading branch information
1 parent
cdf1657
commit 29c71d4
Showing
7 changed files
with
80 additions
and
4 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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: pull-build-image-detector | ||
on: | ||
pull_request_target: | ||
types: [ opened, edited, synchronize, reopened, ready_for_review ] | ||
paths: | ||
- "cmd/image-detector/*.go" | ||
- "cmd/image-detector/Dockerfile" | ||
- "pkg/**" | ||
- "go.mod" | ||
- "go.sum" | ||
|
||
jobs: | ||
build-image: | ||
uses: ./.github/workflows/image-builder.yml | ||
with: | ||
name: image-detector | ||
dockerfile: cmd/image-detector/Dockerfile | ||
context: . | ||
print-image: | ||
runs-on: ubuntu-latest | ||
needs: build-image | ||
steps: | ||
- name: Print image | ||
run: echo "Image built ${{ needs.build-image.outputs.images }}" |
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: push-build-image-detector | ||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- "cmd/image-detector/*.go" | ||
- "cmd/image-detector/Dockerfile" | ||
- "pkg/**" | ||
- "go.mod" | ||
- "go.sum" | ||
|
||
jobs: | ||
build-image: | ||
uses: ./.github/workflows/image-builder.yml | ||
with: | ||
name: image-detector | ||
dockerfile: cmd/image-detector/Dockerfile | ||
context: . | ||
print-image: | ||
runs-on: ubuntu-latest | ||
needs: build-image | ||
steps: | ||
- name: Print image | ||
run: echo "Image built ${{ needs.build-image.outputs.images }}" |
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
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 . . | ||
|
||
WORKDIR /app/cmd/image-detector | ||
|
||
# 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-detector | ||
|
||
# Copy the built Go app from the builder stage | ||
COPY --from=builder /app/cmd/image-detector/main /image-detector | ||
|
||
RUN apk add --no-cache ca-certificates git && \ | ||
chmod +x /image-detector | ||
ENTRYPOINT ["/image-detector"] |
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