ソースを参照

Update build for opencost

Matt Bolt 2 年 前
コミット
dec820c853
2 ファイル変更7 行追加5 行削除
  1. 6 4
      Dockerfile
  2. 1 1
      Makefile

+ 6 - 4
Dockerfile

@@ -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,8 +28,8 @@ 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

+ 1 - 1
Makefile

@@ -6,7 +6,7 @@ GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
 GIT_LAST_COMMIT_DATE := $(shell git log -1 --date=iso-strict --format=%cd)
 
 # Build flags
-VPREFIX := github.com/opencost/opencost/pkg/version
+VPREFIX := github.com/opencost/opencost/core/pkg/version
 GO_LDFLAGS   := -X $(VPREFIX).Version=$(IMAGE_TAG) -X $(VPREFIX).GitCommit=$(GIT_REVISION)
 GO_FLAGS     := -ldflags "-extldflags \"-static\" -s -w $(GO_LDFLAGS)"