-
Notifications
You must be signed in to change notification settings - Fork 13
/
Dockerfile
27 lines (20 loc) · 930 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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.4 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 ./cmd/score-k8s
# We can use gcr.io/distroless/static since we don't rely on any linux libs or state, but we need ca-certificates to connect to https/oci with the init command.
FROM gcr.io/distroless/static
# 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"]