-
Notifications
You must be signed in to change notification settings - Fork 60
Expand file tree
/
Copy pathDockerfile
More file actions
33 lines (25 loc) · 1.29 KB
/
Dockerfile
File metadata and controls
33 lines (25 loc) · 1.29 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 dhi.io/golang:1.26.3-alpine3.23-dev@sha256:8c3d2807b83482ee8736d45c43239b8bfb2319837f22a87e56e20184299c94a7 AS builder
ARG VERSION=0.0.0
ARG GIT_COMMIT=unknown
ARG BUILD_DATE=unknown
# Set the current working directory inside the container.
WORKDIR /go/src/github.com/score-spec/score-compose
# 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-compose/internal/version.Version=${VERSION} \
-X github.com/score-spec/score-compose/internal/version.GitCommit=${GIT_COMMIT} \
-X github.com/score-spec/score-compose/internal/version.BuildDate=${BUILD_DATE}" \
-o /usr/local/bin/score-compose ./cmd/score-compose
# We can use 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 dhi.io/static:20260413-alpine3.23@sha256:eeea5b5f4dc394069d2afb9e83af0b4af640709fda0c2cfbdbdbbb3a4b8ecf6f
# 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-compose /usr/local/bin/score-compose
# Run the binary.
ENTRYPOINT ["/usr/local/bin/score-compose"]