-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
33 lines (25 loc) · 1.44 KB
/
Dockerfile
File metadata and controls
33 lines (25 loc) · 1.44 KB
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
28
29
30
31
32
33
FROM golang:1.26-alpine@sha256:f85330846cde1e57ca9ec309382da3b8e6ae3ab943d2739500e08c86393a21b1 AS builder
ARG VERSION
ARG GIT_COMMIT
ARG BUILD_DATE
# Set the current working directory inside the container.
WORKDIR /go/src/github.com/score-spec/score-implementation-sample
# 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 -ldflags="-s -w \
-X github.com/score-spec/score-implementation-sample/internal/version.Version=${VERSION} \
-X github.com/score-spec/score-implementation-sample/internal/version.GitCommit=${GIT_COMMIT} \
-X github.com/score-spec/score-implementation-sample/internal/version.BuildDate=${BUILD_DATE}" \
-o /usr/local/bin/score-implementation-sample ./cmd/score-implementation-sample
# 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:530158861eebdbbf149f7e7e67bfe45eb433a35c@sha256:5c7e2b465ac6a2a4e5f4f7f722ce43b147dabe87cb21ac6c4007ae5178a1fa58
# Set the current working directory inside the container.
WORKDIR /score-implementation-sample
# Copy the binary from the builder image.
COPY --from=builder /usr/local/bin/score-implementation-sample /usr/local/bin/score-implementation-sample
# Run the binary.
ENTRYPOINT ["/usr/local/bin/score-implementation-sample"]