Skip to content

Commit 50a849c

Browse files
committed
update Makefile
1 parent 779f9dc commit 50a849c

File tree

5 files changed

+27
-3
lines changed

5 files changed

+27
-3
lines changed

mse-go-demo/b-server/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ ADD . /workspace
88

99
WORKDIR /workspace
1010

11-
RUN env GOPROXY=https://goproxy.cn,direct \
11+
RUN --mount=type=cache,target=/go \
12+
env GOPROXY=https://goproxy.cn,direct \
1213
go build -buildmode=pie -ldflags "-linkmode external -extldflags -static -w" -o /workspace
1314

1415
# The RUN line below is an alternative that also results in a static binary

mse-go-demo/b-server/Makefile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
REGISTRY ?=
2+
IMAGE_NAME ?= b-server
3+
IMAGE_TAG ?= 0.1.0
4+
IMG ?= ${REGISTRY}${IMAGE_NAME}:${IMAGE_TAG}
5+
6+
docker-build:
7+
docker build -t ${IMG} . --platform=linux/amd64
8+
9+
docker-push: docker-build
10+
docker push $(IMG)
11+
112
all:
213
protoc --go_out=. --go_opt=paths=source_relative \
314
--go-grpc_out=. --go-grpc_opt=paths=source_relative \

mse-go-demo/b-server/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func (s *server) BMethod(ctx context.Context, req *b_api_pb.BRequest) (*b_api_pb
3131
return nil, err
3232
}
3333
reply := &b_api_pb.BReply{
34-
Message: cReply.GetMessage() + "-> B",
34+
Message: "B->" + cReply.GetMessage(),
3535
}
3636
return reply, nil
3737
}

mse-go-demo/c-server/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ ADD . /workspace
88

99
WORKDIR /workspace
1010

11-
RUN env GOPROXY=https://goproxy.cn,direct \
11+
RUN --mount=type=cache,target=/go \
12+
env GOPROXY=https://goproxy.cn,direct \
1213
go build -buildmode=pie -ldflags "-linkmode external -extldflags -static -w" -o /workspace
1314

1415
# The RUN line below is an alternative that also results in a static binary

mse-go-demo/c-server/Makefile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
REGISTRY ?=
2+
IMAGE_NAME ?= c-server
3+
IMAGE_TAG ?= 0.1.0
4+
IMG ?= ${REGISTRY}${IMAGE_NAME}:${IMAGE_TAG}
5+
6+
docker-build:
7+
docker build -t ${IMG} . --platform=linux/amd64
8+
9+
docker-push: docker-build
10+
docker push $(IMG)
11+
112
all:
213
protoc --go_out=. --go_opt=paths=source_relative \
314
--go-grpc_out=. --go-grpc_opt=paths=source_relative \

0 commit comments

Comments
 (0)