feat: 完成用户微服务 gRPC 实现,包含数据库与服务启动逻辑
This commit is contained in:
23
backend/services/user-svc/Dockerfile
Normal file
23
backend/services/user-svc/Dockerfile
Normal file
@@ -0,0 +1,23 @@
|
||||
FROM golang:1.26.1-alpine3.23 AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY go.mod ./
|
||||
COPY main.go ./
|
||||
COPY user.proto ./
|
||||
|
||||
RUN go mod download
|
||||
RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
|
||||
RUN go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
|
||||
RUN protoc --go_out=. --go-grpc_out=. user.proto
|
||||
RUN go build -o user-svc main.go
|
||||
|
||||
FROM alpine:latest
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=builder /app/user-svc .
|
||||
|
||||
EXPOSE 50051
|
||||
|
||||
CMD ["./user-svc"]
|
||||
Reference in New Issue
Block a user