From 5d0d5e3b1df646274e1181c89c93f6874f925135 Mon Sep 17 00:00:00 2001 From: 7h3-3mp7y-m4n Date: Tue, 15 Oct 2024 20:50:23 +0530 Subject: [PATCH 1/5] Added the Dockerfile for the score-k8s and release too Signed-off-by: 7h3-3mp7y-m4n --- .dockerignore | 6 ++++++ .github/workflows/release.yaml | 20 ++++++++++++++++++-- Dockerfile | 27 +++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..caae439 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +*/ +!go.mod +!go.sum +!.git/ +!internal/ +!main.go/ \ No newline at end of file diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index faaa2c5..fa21aaa 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -11,7 +11,7 @@ jobs: - name: Checkout uses: actions/checkout@v4 with: - fetch-depth: 0 + fetch-depth: 0 - name: Fetch all tags run: git fetch --force --tags - name: Set up Go @@ -26,4 +26,20 @@ jobs: args: release --clean env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - TAP_GITHUB_TOKEN: ${{ secrets.TAP_GITHUB_TOKEN }} + TAP_GITHUB_TOKEN: ${{ secrets.TAP_GITHUB_TOKEN }} + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push docker image + uses: docker/build-push-action@v6 + with: + context: . + platforms: linux/amd64,linux/arm64 + push: true + tags: ghcr.io/score-spec/score-k8s:${{ github.ref_name }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5e22a5e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,27 @@ +# Use the official Golang image to create a build artifact. +# This is based on Debian and sets the GOPATH to /go. +# https://hub.docker.com/_/golang +FROM golang:1.23 AS builder + +# Set the current working directory inside the container. +WORKDIR /go/src/github.com/score-spec/score-k8s + +# Copy just the module bits +COPY go.mod go.sum ./ +RUN go mod download + +# Copy the entire project and build it. +COPY . . +RUN CGO_ENABLED=0 GOOS=linux go build -o /usr/local/bin/score-k8s . + +# We can use scratch since we don't rely on any linux libs or state. +FROM scratch + +# Set the current working directory inside the container. +WORKDIR /score-compose + +# Copy the binary from the builder image. +COPY --from=builder /usr/local/bin/score-k8s /usr/local/bin/score-k8s + +# Run the binary. +ENTRYPOINT ["/usr/local/bin/score-k8s"] \ No newline at end of file From 07378e4eda6c8d50fea0b9d3bdf3af5eda074d80 Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Tue, 15 Oct 2024 15:53:27 -0400 Subject: [PATCH 2/5] Update Dockerfile Signed-off-by: Mathieu Benoit --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 5e22a5e..328ae65 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,7 +18,7 @@ RUN CGO_ENABLED=0 GOOS=linux go build -o /usr/local/bin/score-k8s . FROM scratch # Set the current working directory inside the container. -WORKDIR /score-compose +WORKDIR /score-k8s # Copy the binary from the builder image. COPY --from=builder /usr/local/bin/score-k8s /usr/local/bin/score-k8s From fb55407235516287f3923bf8b5a1ab48d48dab22 Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Tue, 15 Oct 2024 15:53:33 -0400 Subject: [PATCH 3/5] Update .github/workflows/release.yaml Signed-off-by: Mathieu Benoit --- .github/workflows/release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index fa21aaa..bbfda5b 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -11,7 +11,7 @@ jobs: - name: Checkout uses: actions/checkout@v4 with: - fetch-depth: 0 + fetch-depth: 0 - name: Fetch all tags run: git fetch --force --tags - name: Set up Go From 4018bb0b4d38a80e6b8158402a0ab8e127cce269 Mon Sep 17 00:00:00 2001 From: 7h3-3mp7y-m4n Date: Wed, 16 Oct 2024 01:32:21 +0530 Subject: [PATCH 4/5] Added the build container step in ci.yaml and fix the bot Signed-off-by: 7h3-3mp7y-m4n --- .github/dependabot.yml | 8 ++++---- .github/workflows/ci.yaml | 5 +++++ .github/workflows/release.yaml | 1 - 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index fc5df0b..0b69103 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -8,7 +8,7 @@ updates: directory: "/" schedule: interval: "weekly" - #- package-ecosystem: "docker" - # directory: "/" - # schedule: - # interval: "weekly" + - package-ecosystem: "docker" + directory: "/" + schedule: + interval: "weekly" diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index cc1f4b3..90e7180 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -29,3 +29,8 @@ jobs: run: go install github.com/google/addlicense@latest - name: Check licenses run: addlicense -l apache -check -v -ignore '**/*.yaml' -c Humanitec ./*.go ./internal/ + - name: Build docker image + uses: docker/build-push-action@v6 + with: + context: . + push: false diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index fa21aaa..ed47e0a 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -35,7 +35,6 @@ jobs: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Build and push docker image uses: docker/build-push-action@v6 with: From 0831a5e2f455b3464ffafa47e87f49669916dde3 Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Tue, 15 Oct 2024 16:25:57 -0400 Subject: [PATCH 5/5] Update dependabot.yml Signed-off-by: Mathieu Benoit --- .github/dependabot.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 0b69103..cbeb001 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -9,6 +9,6 @@ updates: schedule: interval: "weekly" - package-ecosystem: "docker" - directory: "/" - schedule: - interval: "weekly" + directory: "/" + schedule: + interval: "weekly"