44 lines
948 B
Makefile
44 lines
948 B
Makefile
.PHONY: dev dev-web build build-web run test tidy clean docker-build
|
|
|
|
export GOPROXY ?= https://goproxy.cn,direct
|
|
export GOSUMDB ?= sum.golang.google.cn
|
|
export IMAGE_PREFIX ?= docker.1panel.live/library/
|
|
export APP_IMAGE ?= go-vue-template:latest
|
|
|
|
dev:
|
|
@echo "Run backend and frontend in separate terminals:"
|
|
@echo " make run"
|
|
@echo " make dev-web"
|
|
|
|
dev-web:
|
|
cd web && npm install && npm run dev
|
|
|
|
build-web:
|
|
cd web && npm install && npm run build
|
|
rm -rf internal/api/static/*
|
|
cp -r web/dist/* internal/api/static/
|
|
|
|
build: build-web
|
|
go build -o dist/app ./cmd/app
|
|
|
|
run:
|
|
go run ./cmd/app
|
|
|
|
tidy:
|
|
go mod tidy
|
|
|
|
test:
|
|
go test ./...
|
|
|
|
clean:
|
|
rm -rf dist web/dist internal/api/static/*
|
|
@echo '<!DOCTYPE html><html><body>App</body></html>' > internal/api/static/index.html
|
|
|
|
docker-build:
|
|
docker build \
|
|
-t $(APP_IMAGE) \
|
|
--build-arg IMAGE_PREFIX=$(IMAGE_PREFIX) \
|
|
--build-arg GOPROXY=$(GOPROXY) \
|
|
--build-arg GOSUMDB=$(GOSUMDB) \
|
|
.
|