|
|
@@ -14,10 +14,12 @@ ARG CGO_ENABLED=0
|
|
|
ARG version=dev
|
|
|
ARG commit=HEAD
|
|
|
|
|
|
-# Get dependencies - will also be cached if we won't change mod/sum
|
|
|
-RUN go mod download
|
|
|
# COPY the source code as the last step
|
|
|
COPY . .
|
|
|
+
|
|
|
+# Get dependencies - will also be cached if we won't change mod/sum
|
|
|
+RUN go mod download
|
|
|
+
|
|
|
# Build the binary
|
|
|
RUN set -e ;\
|
|
|
go test ./test/*.go;\
|
|
|
@@ -26,11 +28,19 @@ RUN set -e ;\
|
|
|
GOOS=linux \
|
|
|
go build -a -installsuffix cgo \
|
|
|
-ldflags \
|
|
|
- "-X github.com/opencost/opencost/pkg/version.Version=${version} \
|
|
|
- -X github.com/opencost/opencost/pkg/version.GitCommit=${commit}" \
|
|
|
+ "-X github.com/opencost/opencost/core/pkg/version.Version=${version} \
|
|
|
+ -X github.com/opencost/opencost/core/pkg/version.GitCommit=${commit}" \
|
|
|
-o /go/bin/app
|
|
|
|
|
|
FROM alpine:latest
|
|
|
+
|
|
|
+LABEL org.opencontainers.image.description="Cross-cloud cost allocation models for Kubernetes workloads"
|
|
|
+LABEL org.opencontainers.image.documentation=https://opencost.io/docs/
|
|
|
+LABEL org.opencontainers.image.licenses=Apache-2.0
|
|
|
+LABEL org.opencontainers.image.source=https://github.com/opencost/opencost
|
|
|
+LABEL org.opencontainers.image.title=kubecost-cost-model
|
|
|
+LABEL org.opencontainers.image.url=https://github.com/opencost/opencost
|
|
|
+
|
|
|
RUN apk add --update --no-cache ca-certificates
|
|
|
COPY --from=build-env /go/bin/app /go/bin/app
|
|
|
ADD --chmod=644 ./configs/default.json /models/default.json
|