-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Request: 是否可以实现生成 k8s 配置文件和 Dockerfile 的功能 #197
Comments
可以说下更详细的需求,例如根据什么(idl的哪部分信息),来生成配置文件,配置文件中包含哪些信息? |
可以参考一下 go-zero 的代码生成工具goctl 的文档中描述的功能:https://go-zero.dev/docs/tutorials/cli/docker 我们在将部署微服务时需要编写 Dockerfile,以将我们的镜像发布并部署到 k8s,最后生成的 Dockerfile 应该类似这样: FROM golang:alpine AS builder
LABEL stage=gobuilder
ENV CGO_ENABLED 0
ENV GOPROXY https://goproxy.cn,direct
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
RUN apk update --no-cache && apk add --no-cache tzdata
WORKDIR /build
ADD go.mod .
ADD go.sum .
RUN go mod download
COPY . .
COPY rpc_study/user_api_rpc/api/etc /app/etc
RUN go build -ldflags="-s -w" -o /app/user rpc_study/user_api_rpc/api/user.go
FROM scratch
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=builder /usr/share/zoneinfo/Asia/Shanghai /usr/share/zoneinfo/Asia/Shanghai
ENV TZ Asia/Shanghai
WORKDIR /app
COPY --from=builder /app/user /app/user
COPY --from=builder /app/etc /app/etc
CMD ["./user", "-f", "etc/user.yaml"]
他应该不需要借助 idl 去生成,而是通过需要打包的服务的文件名称,获取其相对于项目的根路径的相对路径来实现 需要实现的最终效果最好如下:
|
同样的,k8s 的配置文件可以参考一下这个:https://go-zero.dev/docs/tutorials/cli/kube 这些在实际的项目部署过程中都是比较重要的文件,同时也是我们编写起来比较麻烦的文件 |
ok的,我找个时间支持一下 |
我想试试这个Request,可以指派我吗 |
十分欢迎! |
@StellarisW Hi, I have already committed the PR and passed my own testing. Can you please review it? |
No description provided.
The text was updated successfully, but these errors were encountered: