mirror of
https://github.com/minio/minio.git
synced 2024-12-24 06:05:55 -05:00
docker: second --ldflags was overriding the first --ldflags option
This commit is contained in:
parent
03f185db5f
commit
f77851bee0
6
Makefile
6
Makefile
@ -1,5 +1,5 @@
|
||||
LDFLAGS := $(shell go run buildscripts/gen-ldflags.go)
|
||||
DOCKER_LDFLAGS = '-extldflags "-static"'
|
||||
DOCKER_LDFLAGS := $(LDFLAGS) -extldflags "-static"
|
||||
TAG := latest
|
||||
|
||||
all: install
|
||||
@ -55,7 +55,7 @@ test: build
|
||||
@GO15VENDOREXPERIMENT=1 go test $(GOFLAGS) github.com/minio/minio/pkg...
|
||||
|
||||
gomake-all: build
|
||||
GO15VENDOREXPERIMENT=1 go build --ldflags $(LDFLAGS) -o $(GOPATH)/bin/minio
|
||||
@GO15VENDOREXPERIMENT=1 go build --ldflags '$(LDFLAGS)' -o $(GOPATH)/bin/minio
|
||||
|
||||
pkg-add:
|
||||
@GO15VENDOREXPERIMENT=1 govendor add $(PKG)
|
||||
@ -70,7 +70,7 @@ install: gomake-all
|
||||
|
||||
dockerimage: install
|
||||
@echo "Building docker image:" minio:$(TAG)
|
||||
@GO15VENDOREXPERIMENT=1 go build --ldflags $(LDFLAGS) --ldflags $(DOCKER_LDFLAGS) -o minio.dockerimage
|
||||
@GO15VENDOREXPERIMENT=1 go build --ldflags '$(DOCKER_LDFLAGS)' -o minio.dockerimage
|
||||
@mkdir -p export
|
||||
@docker build --rm --tag=minio:$(TAG) .
|
||||
@rmdir export
|
||||
|
@ -26,9 +26,10 @@ build_script:
|
||||
- go test -race .
|
||||
- go test github.com/minio/minio/pkg...
|
||||
- go test -race github.com/minio/minio/pkg...
|
||||
- go run buildscripts/gen-ldflags.go > temp.txt
|
||||
- set /p LDFLAGS=<temp.txt
|
||||
- go build --ldflags %LDFLAGS% -o %GOPATH%\bin\minio.exe
|
||||
# FIXME: appveyor build has errors related to LDFLAGS
|
||||
# - go run buildscripts/gen-ldflags.go > temp.txt
|
||||
# - set /p LDFLAGS=<temp.txt
|
||||
# - go build --ldflags %LDFLAGS% -o %GOPATH%\bin\minio.exe
|
||||
|
||||
# to disable automatic tests
|
||||
test: off
|
||||
|
@ -28,10 +28,10 @@ import (
|
||||
|
||||
func genLDFlags(version string) string {
|
||||
var ldflagsStr string
|
||||
ldflagsStr = "\"-X main.minioVersion=" + version + " "
|
||||
ldflagsStr = "-X main.minioVersion=" + version + " "
|
||||
ldflagsStr = ldflagsStr + "-X main.minioReleaseTag=" + releaseTag(version) + " "
|
||||
ldflagsStr = ldflagsStr + "-X main.minioCommitID=" + commitID() + " "
|
||||
ldflagsStr = ldflagsStr + "-X main.minioShortCommitID=" + commitID()[:12] + "\""
|
||||
ldflagsStr = ldflagsStr + "-X main.minioShortCommitID=" + commitID()[:12]
|
||||
return ldflagsStr
|
||||
}
|
||||
|
||||
|
3
main.go
3
main.go
@ -156,6 +156,9 @@ func main() {
|
||||
probe.Init() // Set project's root source path.
|
||||
probe.SetAppInfo("Release-Tag", minioReleaseTag)
|
||||
probe.SetAppInfo("Commit-ID", minioShortCommitID)
|
||||
if os.Getenv("DOCKERIMAGE") == "1" {
|
||||
probe.SetAppInfo("Docker-Image", "true")
|
||||
}
|
||||
|
||||
app := registerApp()
|
||||
app.Before = func(c *cli.Context) error {
|
||||
|
@ -16,7 +16,11 @@
|
||||
|
||||
package main
|
||||
|
||||
import "github.com/minio/cli"
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/minio/cli"
|
||||
)
|
||||
|
||||
var versionCmd = cli.Command{
|
||||
Name: "version",
|
||||
@ -34,4 +38,7 @@ func mainVersion(ctxx *cli.Context) {
|
||||
Println("Version: " + minioVersion)
|
||||
Println("Release-Tag: " + minioReleaseTag)
|
||||
Println("Commit-ID: " + minioCommitID)
|
||||
if os.Getenv("DOCKERIMAGE") == "1" {
|
||||
Println("Docker-Image: " + "true")
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user