Skip to content

Commit

Permalink
Use go mod vendor to not download dependencies 4 times when building
Browse files Browse the repository at this point in the history
  • Loading branch information
jmattheis committed Mar 1, 2019
1 parent f7a8939 commit c458087
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -75,18 +75,21 @@ build-docker: require-version
build-js:
(cd ui && npm run build)

build-linux-amd64:
docker run --rm -v "$$PWD/.:/proj" -w /proj gotify/build:$(GO_VERSION)-linux-amd64 go build -a -installsuffix cgo -ldflags "$$LD_FLAGS" -o build/gotify-linux-amd64 /proj
vendor:
go mod vendor

build-linux-amd64: vendor
docker run --rm -v "$$PWD/.:/proj" -w /proj gotify/build:$(GO_VERSION)-linux-amd64 go build -mod=vendor -a -installsuffix cgo -ldflags "$$LD_FLAGS" -o build/gotify-linux-amd64 /proj

build-linux-arm-7:
docker run --rm -v "$$PWD/.:/proj" -w /proj gotify/build:$(GO_VERSION)-linux-arm-7 go build -a -installsuffix cgo -ldflags "$$LD_FLAGS" -o build/gotify-linux-arm-7 /proj
build-linux-arm-7: vendor
docker run --rm -v "$$PWD/.:/proj" -w /proj gotify/build:$(GO_VERSION)-linux-arm-7 go build -mod=vendor -a -installsuffix cgo -ldflags "$$LD_FLAGS" -o build/gotify-linux-arm-7 /proj

build-linux-arm64:
docker run --rm -v "$$PWD/.:/proj" -w /proj gotify/build:$(GO_VERSION)-linux-arm64 go build -a -installsuffix cgo -ldflags "$$LD_FLAGS" -o build/gotify-linux-arm64 /proj
build-linux-arm64: vendor
docker run --rm -v "$$PWD/.:/proj" -w /proj gotify/build:$(GO_VERSION)-linux-arm64 go build -mod=vendor -a -installsuffix cgo -ldflags "$$LD_FLAGS" -o build/gotify-linux-arm64 /proj

build-windows-amd64:
docker run --rm -v "$$PWD/.:/proj" -w /proj gotify/build:$(GO_VERSION)-windows-amd64 go build -a -installsuffix cgo -ldflags "$$LD_FLAGS" -o build/gotify-windows-amd64.exe /proj
build-windows-amd64: vendor
docker run --rm -v "$$PWD/.:/proj" -w /proj gotify/build:$(GO_VERSION)-windows-amd64 go build -mod=vendor -a -installsuffix cgo -ldflags "$$LD_FLAGS" -o build/gotify-windows-amd64.exe /proj

build: build-linux-arm-7 build-linux-amd64 build-linux-arm64 build-windows-amd64

.PHONY: test-race test-coverage test check-go check-js verify-swagger check download-tools update-swagger package-zip build-docker build-js build
.PHONY: test-race test-coverage test check-go check-js verify-swagger check download-tools update-swagger package-zip build-docker build-js build

0 comments on commit c458087

Please sign in to comment.