build: add linux amd64 production package target
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -5,6 +5,7 @@
|
||||
configs/config.local.yml
|
||||
web/node_modules/
|
||||
bin/
|
||||
dist/
|
||||
coverage.out
|
||||
docs/
|
||||
|
||||
|
||||
13
Makefile
13
Makefile
@@ -6,8 +6,9 @@ CONFIG_DIR ?= configs
|
||||
CONFIG_FILE ?=
|
||||
ENV_FILE ?= config.yml
|
||||
BUILD_DIR ?= bin
|
||||
DIST_DIR ?= dist
|
||||
|
||||
.PHONY: web-install web-build sdk-install sdk-build build run test vet check seed-pet-doctor docker-config docker-up docker-down docker-logs
|
||||
.PHONY: web-install web-build sdk-install sdk-build build package-linux-amd64-prod run test vet check seed-pet-doctor docker-config docker-up docker-down docker-logs
|
||||
|
||||
web-install:
|
||||
cd $(WEB_DIR) && npm install
|
||||
@@ -29,6 +30,16 @@ build: web-build sdk-build
|
||||
@if [ "$(ENV_FILE)" != "config.yml" ]; then cp $(CONFIG_DIR)/$(ENV_FILE) $(BUILD_DIR)/configs/$(ENV_FILE); fi
|
||||
CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(ARCH) go build -o $(BUILD_DIR)/main .
|
||||
|
||||
package-linux-amd64-prod: GOOS := linux
|
||||
package-linux-amd64-prod: ARCH := amd64
|
||||
package-linux-amd64-prod: ENV_FILE := config.prod.yml
|
||||
package-linux-amd64-prod: BUILD_DIR := bin/linux-amd64-prod
|
||||
package-linux-amd64-prod: PACKAGE_FILE := $(DIST_DIR)/iqudo-top1-linux-amd64-prod.tar.gz
|
||||
package-linux-amd64-prod: build
|
||||
mkdir -p $(DIST_DIR)
|
||||
tar -czf $(PACKAGE_FILE) -C $(BUILD_DIR) main configs
|
||||
@echo "created $(PACKAGE_FILE)"
|
||||
|
||||
run: build
|
||||
./$(BUILD_DIR)/main -config-dir $(if $(CONFIG_FILE),$(CONFIG_DIR),$(BUILD_DIR)/configs) $(if $(CONFIG_FILE),-config-file $(CONFIG_FILE),)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user