Skip to content

Commit

Permalink
Merge pull request #52 from 7h3-3mp7y-m4n/docker
Browse files Browse the repository at this point in the history
Added the Dockerfile for the score-k8s and release too
  • Loading branch information
mathieu-benoit authored Oct 15, 2024
2 parents 2d54712 + 0831a5e commit ffbb20d
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 5 deletions.
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*/
!go.mod
!go.sum
!.git/
!internal/
!main.go/
8 changes: 4 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ updates:
directory: "/"
schedule:
interval: "weekly"
#- package-ecosystem: "docker"
# directory: "/"
# schedule:
# interval: "weekly"
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "weekly"
5 changes: 5 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
17 changes: 16 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,19 @@ 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 }}
27 changes: 27 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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-k8s

# 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"]

0 comments on commit ffbb20d

Please sign in to comment.