-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
makefile编译客户端协议、生成服务器配置表 && docker镜像构建
- Loading branch information
Showing
16 changed files
with
201 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,65 @@ | ||
CUR_DIR=$(shell pwd) | ||
|
||
VERSION=1.0.0 | ||
|
||
# 清理 | ||
.PHONY: clean | ||
clean: | ||
rm -rf ./bin | ||
rm -rf ./protocol/proto | ||
rm -rf ./gate/client_proto/client_proto_gen.go | ||
rm -rf ./gdconf/game_data_config/csv/*.csv | ||
|
||
# 构建服务器二进制文件 | ||
.PHONY: build | ||
build: | ||
mkdir -p bin/ && CGO_ENABLED=0 go build -ldflags "-X main.Version=$(VERSION)" -o ./bin/ ./cmd/... | ||
mkdir -p bin && CGO_ENABLED=0 go build -ldflags "-X main.Version=$(VERSION)" -o ./bin/ ./cmd/... | ||
|
||
# 清理镜像 | ||
.PHONY: docker_clean | ||
docker_clean: | ||
rm -rf ./docker/node/bin/* | ||
rm -rf ./docker/dispatch/bin/* | ||
rm -rf ./docker/gate/bin/* | ||
rm -rf ./docker/fight/bin/* | ||
rm -rf ./docker/pathfinding/bin/* | ||
rm -rf ./docker/gs/bin/* | ||
rm -rf ./docker/gm/bin/* | ||
docker rmi flswld/node:$(VERSION) | ||
docker rmi flswld/dispatch:$(VERSION) | ||
docker rmi flswld/gate:$(VERSION) | ||
docker rmi flswld/fight:$(VERSION) | ||
docker rmi flswld/pathfinding:$(VERSION) | ||
docker rmi flswld/gs:$(VERSION) | ||
docker rmi flswld/gm:$(VERSION) | ||
|
||
# 构建镜像 | ||
.PHONY: docker_build | ||
docker_build: | ||
mkdir -p ./docker/node/bin && cp -rf ./bin/node ./cmd/node/* ./docker/node/bin/ | ||
mkdir -p ./docker/dispatch/bin && cp -rf ./bin/dispatch ./cmd/dispatch/* ./docker/dispatch/bin/ | ||
mkdir -p ./docker/gate/bin && cp -rf ./bin/gate ./cmd/gate/* ./docker/gate/bin/ | ||
mkdir -p ./docker/fight/bin && cp -rf ./bin/fight ./cmd/fight/* ./docker/fight/bin/ | ||
mkdir -p ./docker/pathfinding/bin && cp -rf ./bin/pathfinding ./cmd/pathfinding/* ./docker/pathfinding/bin/ | ||
mkdir -p ./docker/gs/bin && cp -rf ./bin/gs ./cmd/gs/* ./docker/gs/bin/ | ||
mkdir -p ./docker/gm/bin && cp -rf ./bin/gm ./cmd/gm/* ./docker/gm/bin/ | ||
docker build -t flswld/node:$(VERSION) ./docker/node | ||
docker build -t flswld/dispatch:$(VERSION) ./docker/dispatch | ||
docker build -t flswld/gate:$(VERSION) ./docker/gate | ||
docker build -t flswld/fight:$(VERSION) ./docker/fight | ||
docker build -t flswld/pathfinding:$(VERSION) ./docker/pathfinding | ||
docker build -t flswld/gs:$(VERSION) ./docker/gs | ||
docker build -t flswld/gm:$(VERSION) ./docker/gm | ||
|
||
# 安装natsrpc生成工具 | ||
.PHONY: dev_tool | ||
dev_tool: | ||
# 安装natsrpc生成工具 | ||
go install github.com/golang/protobuf/[email protected] | ||
go install github.com/byebyebruce/natsrpc/cmd/protoc-gen-natsrpc@develop | ||
|
||
test: | ||
go test ./... | ||
|
||
# 生成natsrpc协议代码 | ||
.PHONY: gen_natsrpc | ||
gen_natsrpc: | ||
# 生成natsrpc协议代码 | ||
protoc \ | ||
--proto_path=gs/api \ | ||
--go_out=paths=source_relative:gs/api \ | ||
|
@@ -27,9 +71,9 @@ gen_natsrpc: | |
--natsrpc_out=paths=source_relative:node/api \ | ||
node/api/*.proto | ||
|
||
# 生成客户端协议代码 | ||
.PHONY: gen_proto | ||
gen_proto: | ||
# 生成客户端协议代码 | ||
cd protocol/proto_hk4e && \ | ||
rm -rf ./proto && mkdir -p proto && \ | ||
protoc --proto_path=./ --go_out=paths=source_relative:./proto ./*.proto && \ | ||
|
@@ -41,3 +85,13 @@ gen_proto: | |
mv ./proto/server_only/* ./proto/ && rm -rf ./proto/server_only && \ | ||
rm -rf ../proto && mkdir -p ../proto && mv ./proto/* ../proto/ && rm -rf ./proto && \ | ||
cd ../../ | ||
|
||
# 生成服务器配置表 | ||
.PHONY: gen_csv | ||
gen_csv: | ||
cd gdconf && go test -v -run TestGenGdCsv . | ||
|
||
# 生成客户端协议代理功能所需的代码 | ||
.PHONY: gen_client_proto | ||
gen_client_proto: | ||
cd gate/client_proto && go test -v -run TestClientProtoGen . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
FROM ubuntu:18.04 | ||
|
||
EXPOSE 8080/tcp | ||
|
||
WORKDIR /dispatch | ||
COPY ./bin/dispatch ./dispatch | ||
RUN chmod +x ./dispatch | ||
|
||
ENTRYPOINT ["./dispatch"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM ubuntu:18.04 | ||
|
||
WORKDIR /fight | ||
COPY ./bin/fight ./fight | ||
RUN chmod +x ./fight | ||
|
||
ENTRYPOINT ["./fight"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
FROM ubuntu:18.04 | ||
|
||
EXPOSE 22222/udp | ||
EXPOSE 33333/tcp | ||
|
||
WORKDIR /gate | ||
COPY ./bin/gate ./gate | ||
RUN chmod +x ./gate | ||
|
||
ENTRYPOINT ["./gate"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
FROM ubuntu:18.04 | ||
|
||
EXPOSE 9001/tcp | ||
|
||
WORKDIR /gm | ||
COPY ./bin/gm ./gm | ||
RUN chmod +x ./gm | ||
|
||
ENTRYPOINT ["./gm"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM ubuntu:18.04 | ||
|
||
WORKDIR /gs | ||
COPY ./bin/gs ./gs | ||
RUN chmod +x ./gs | ||
|
||
ENTRYPOINT ["./gs"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM ubuntu:18.04 | ||
|
||
WORKDIR /node | ||
COPY ./bin/node ./node | ||
RUN chmod +x ./node | ||
|
||
ENTRYPOINT ["./node"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM ubuntu:18.04 | ||
|
||
WORKDIR /pathfinding | ||
COPY ./bin/pathfinding ./pathfinding | ||
RUN chmod +x ./pathfinding | ||
|
||
ENTRYPOINT ["./pathfinding"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.