chore: change template

This commit is contained in:
Young Xu 2024-03-11 01:15:32 +08:00
parent 4259c77974
commit d95b9c4cb1
3 changed files with 19 additions and 14 deletions

View File

@ -4,7 +4,7 @@ const templateApiservicesProto = `syntax = "proto3";
package proto.v1; package proto.v1;
option go_package = "project/gen;genv1"; option go_package = "{{.Name}}/gen;genv1";
// @route_group: true // @route_group: true

View File

@ -4,7 +4,7 @@ const templateProto = `syntax = "proto3";
package proto.v1; package proto.v1;
option go_package = "project/gen;genv1"; option go_package = "{{.Name}}/gen;genv1";
// @table_name: t_file // @table_name: t_file

View File

@ -15,6 +15,7 @@ else
endif endif
wire: wire:
go mod tidy
cd gen/wire && wire cd gen/wire && wire
ui: ui:
@ -24,32 +25,36 @@ api:
go mod tidy && go build . go mod tidy && go build .
./{{.Name}} api ./{{.Name}} api
build: gen wire ui api
run: gen wire ui api
./{{.Name}} api
all: gen wire ui api all: gen wire ui api
docker:
podman build -t images.internal/{{.Name}}:latest .
podman push images.internal/{{.Name}}:latest
` `
const templateDockerfile = `FROM images.local/golang:latest const templateDockerfile = `FROM images.internal/devel:latest
WORKDIR /app WORKDIR /app
RUN go install gitter.top/coco/protoc-gen-coco@latest &&\
go install github.com/golang/protobuf/protoc-gen-go@latest &&\
go install github.com/bufbuild/buf/cmd/...@latest
COPY . /app COPY . /app
RUN npm install ts-proto
RUN buf generate --exclude-path node_modules
RUN cd webui && npm install && npm run build &&\
cd .. && go mod tidy && go build .
EXPOSE 38080 RUN make build
ENTRYPOINT [ "./filesaver", "api" ]
EXPOSE 38001
ENTRYPOINT [ "./{{.Name}}", "api" ]
` `
const templateDockerCompose = `version: "3" const templateDockerCompose = `version: "3"
services: services:
server: server:
image: xuthus5/{{.Name}}:latest image: images.internal/{{.Name}}:latest
container_name: {{.Name}} container_name: {{.Name}}
restart: always restart: always
volumes: volumes: