weixin/Makefile

49 lines
1.2 KiB
Makefile
Raw Normal View History

2021-11-10 01:44:51 +08:00
include .env
include .env.local
2021-11-10 03:12:32 +08:00
.PHONY: build proto
2021-11-10 01:44:51 +08:00
run:
go run cmd/mp-server/main.go \
--wx.app.id=${WEIXIN_APP_ID} \
--wx.app.secret=${WEIXIN_APP_SECRET} \
--pg.dsn=${POSTGRES_DSN}
clean:
rm -rf ${PROTOC_OUT_DIR}
rm -rf ${OPENAPI_OUT_DIR}
all: api
2021-11-10 03:12:32 +08:00
build:
CGO_ENABLED=0 GOOS="linux" GOARCH="amd64" \
go build -o ./build/app -ldflags="-s -w" -tags timetzdata ./cmd/mp-server
upx build/app
docker build -t esinio/weixin:mp-auth .
rm build/app
2021-11-10 01:44:51 +08:00
docker.push:
docker push esinio/weixin:oauth2
api: api.out.dir api.oauth2
@echo "\nall protos generated \n"
api.out.dir:
mkdir -p ${PROTOC_OUT_DIR}
mkdir -p ${OPENAPI_OUT_DIR}
api.oauth2: api.out.dir
protoc \
--proto_path ${PROTOC_SRC_DIR} \
--proto_path ${PROTOC_SRC_DIR}/third_party \
--go_out ${PROTOC_OUT_DIR} \
--go_opt paths=source_relative \
--go-grpc_out ${PROTOC_OUT_DIR} \
--go-grpc_opt paths=source_relative \
--grpc-gateway_out ${PROTOC_OUT_DIR} \
--grpc-gateway_opt paths=source_relative \
--grpc-gateway_opt logtostderr=true \
--grpc-gateway_opt generate_unbound_methods=true \
--openapiv2_out ${OPENAPI_OUT_DIR} \
--openapiv2_opt logtostderr=true \
${PROTOC_SRC_DIR}/clientapi/mp/auth/auth.proto