Skip to content

Commit

Permalink
Merge pull request #92 from onepanelio/feat/dockerize
Browse files Browse the repository at this point in the history
feat: dockerized command to build CLI and fixed issue windows build
  • Loading branch information
rushtehrani authored Jan 11, 2021
2 parents d3b5592 + 805b929 commit d83fdb1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
24 changes: 18 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
.PHONY: init

init:
ifndef version
$(error CLI version is undefined)
endif
Expand All @@ -11,11 +14,11 @@ ifndef core-ui-version-tag
$(error core-ui version tag is undefined)
endif

ldflags := "\
-X github.com/onepanelio/cli/config.CLIVersion=$(version)\
-X github.com/onepanelio/cli/config.ManifestsRepositoryTag=$(manifests-version-tag)\
-X github.com/onepanelio/cli/config.CoreImageTag=$(core-version-tag)\
-X github.com/onepanelio/cli/config.CoreUIImageTag=$(core-ui-version-tag)"
ldflags := "\
-X github.com/onepanelio/cli/config.CLIVersion=$(version)\
-X github.com/onepanelio/cli/config.ManifestsRepositoryTag=$(manifests-version-tag)\
-X github.com/onepanelio/cli/config.CoreImageTag=$(core-version-tag)\
-X github.com/onepanelio/cli/config.CoreUIImageTag=$(core-ui-version-tag)"

build-linux-amd64:
env GOOS=linux GOARCH=amd64 go build \
Expand All @@ -35,4 +38,13 @@ build-windows-amd64:
-ldflags $(ldflags) \
main.go

all: build-linux-amd64 build-macos-amd64 build-windows-amd64
all-internal: init build-linux-amd64 build-macos-amd64 build-windows-amd64

all:
docker run --rm \
-e version=$(version) \
-e manifests-version-tag=$(manifests-version-tag) \
-e core-version-tag=$(core-version-tag) \
-e core-ui-version-tag=$(core-ui-version-tag) \
-v "$(PWD)":/usr/src/myapp -w /usr/src/myapp golang:1.15 \
make all-internal
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/onepanelio/cli

go 1.13
go 1.15

require (
github.com/ghodss/yaml v1.0.0
Expand All @@ -10,8 +10,8 @@ require (
github.com/pkg/errors v0.9.1
github.com/spf13/cobra v0.0.5
github.com/spf13/viper v1.5.0
golang.org/x/crypto v0.0.0-20200128174031-69ecbb4d6d5d
github.com/stretchr/testify v1.4.0
golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392
gopkg.in/yaml.v2 v2.2.8
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776
k8s.io/apimachinery v0.17.3
Expand Down

0 comments on commit d83fdb1

Please sign in to comment.