initial commit

This commit is contained in:
2025-05-22 19:39:08 +08:00
commit 531bb42d01
103 changed files with 10291 additions and 0 deletions

View File

@ -0,0 +1,31 @@
FROM golang:alpine AS builder
LABEL stage=gobuilder
ENV GOPROXY=https://goproxy.cn,direct
ENV CGO_ENABLED=0
RUN apk update --no-cache && apk add --no-cache tzdata
WORKDIR /build
ADD go.mod .
ADD go.sum .
RUN go mod download
COPY . .
RUN go build -ldflags="-s -w" -o /app/category category/category.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/category /app/category
CMD ["./category", "-f", "etc/config.yaml"]

View File

@ -0,0 +1,17 @@
services:
category:
image: category:v1
container_name: category
restart: always
volumes:
- ./etc:/app/etc
networks:
- godemo_network
# 端口映射,生产环境非必须,开发环境用于方便调试
ports:
- "60300:60300"
networks:
godemo_network:
name: godemo_network
external: true

View File

@ -0,0 +1,13 @@
Name: category.rpc
ListenOn: 0.0.0.0:60300
Mode: dev
Etcd:
Hosts:
- etcd:2379
Key: category.rpc
DB:
DataSource: postgres://postgres:postgres@localhost:5432/godemo?sslmode=disable
MaxOpenConns: 100
MaxIdleConns: 20
ConnMaxLifetime: 3600

View File

@ -0,0 +1,30 @@
FROM golang:alpine AS builder
LABEL stage=gobuilder
ENV GOPROXY=https://goproxy.cn,direct
ENV CGO_ENABLED=0
RUN apk update --no-cache && apk add --no-cache tzdata
WORKDIR /build
ADD go.mod .
ADD go.sum .
RUN go mod download
COPY . .
RUN go build -ldflags="-s -w" -o /app/file file/file.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/file /app/file
CMD ["./file", "-f", "etc/config.yaml"]

View File

@ -0,0 +1,17 @@
services:
file:
image: file:v1
container_name: file
restart: always
volumes:
- ./etc:/app/etc
networks:
- godemo_network
# 端口映射,生产环境非必须,开发环境用于方便调试
ports:
- "60200:60200"
networks:
godemo_network:
name: godemo_network
external: true

View File

@ -0,0 +1,14 @@
Name: file.rpc
ListenOn: 0.0.0.0:60200
Mode: dev
Etcd:
Hosts:
- etcd:2379
Key: file.rpc
Minio:
Endpoint: "minio:9000"
Id: "minioadmin"
Secret: "minioadmin"
Token: ""
Secure: false

View File

@ -0,0 +1,30 @@
FROM golang:alpine AS builder
LABEL stage=gobuilder
ENV GOPROXY=https://goproxy.cn,direct
ENV CGO_ENABLED=0
RUN apk update --no-cache && apk add --no-cache tzdata
WORKDIR /build
ADD go.mod .
ADD go.sum .
RUN go mod download
COPY . .
RUN go build -ldflags="-s -w" -o /app/gateway gateway/gateway.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/gateway /app/gateway
CMD ["./gateway", "-f", "etc/config.yaml"]

View File

@ -0,0 +1,16 @@
services:
gateway:
image: gateway:v1
container_name: gateway
restart: always
ports:
- 60000:60000
volumes:
- ./etc:/app/etc
networks:
- godemo_network
networks:
godemo_network:
name: godemo_network
external: true

View File

@ -0,0 +1,13 @@
Name: gateway-api
Host: 0.0.0.0
Port: 60000
JwtAuth:
AccessSecret: "your-secure-secret"
AccessExpire: 900 # 可选单位秒15分钟
UserRpc:
Etcd:
Hosts:
- etcd:2379
Key: user.rpc

View File

@ -0,0 +1,30 @@
FROM golang:alpine AS builder
LABEL stage=gobuilder
ENV GOPROXY=https://goproxy.cn,direct
ENV CGO_ENABLED=0
RUN apk update --no-cache && apk add --no-cache tzdata
WORKDIR /build
ADD go.mod .
ADD go.sum .
RUN go mod download
COPY . .
RUN go build -ldflags="-s -w" -o /app/user user/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
CMD ["./user", "-f", "etc/config.yaml"]

View File

@ -0,0 +1,17 @@
services:
user:
image: user:v1
container_name: user
restart: always
volumes:
- ./etc:/app/etc
networks:
- godemo_network
# 端口映射,生产环境非必须,开发环境用于方便调试
ports:
- "60100:60100"
networks:
godemo_network:
name: godemo_network
external: true

View File

@ -0,0 +1,13 @@
Name: user.rpc
ListenOn: 0.0.0.0:60100
Mode: dev
Etcd:
Hosts:
- etcd:2379
Key: user.rpc
DataSource: "postgres://postgres:postgres@postgres:5432/godemo?sslmode=disable"
JwtAuth:
AccessSecret: "your-secure-secret"
AccessExpire: 900 # 可选单位秒15分钟