后端使用 golang gin gorm 开发,移动端使用 Flutter 构建。 前端项目地址
- postgresql
- minio
- jwt
.
├── Dockerfile
├── LICENSE
├── README.md
├── build.sh
├── cmd
│ └── main.go
├── config
│ ├── application.toml
│ └── db.toml
├── db
│ └── init.sql
├── go.mod
└── internal
├── config
├── dao
├── model
├── server
├── service
└── util
config
文件夹下
- db 配置
[Db]
Dns = "host=127.0.0.1 user=writer password=123 dbname=xiaohuazhu port=5432 sslmode=disable TimeZone=Asia/Shanghai"
PreferSimpleProtocol = true
[Oss]
Endpoint = "127.0.0.1:9000"
AccessPrefix = "http://127.0.0.1/"
Id = "minio"
Secret = "123456789"
Token = ""
- 应用配置
name、端口、默认 Icon 、JWT 配置
[Application]
Name = "xiaohuazhu"
Port = "8080"
DefaultIcon = "image/picture_b27918ac-b14c-47b8-a93f-f07ccd122aa3.jpg"
[Application.Auth]
PasswordSalt = "_salt"
JwtSigned = "bf19d68e1caee5738c7c7194107ec897"
JwtExpireHour = 168
# 第一阶段构建
FROM golang:1.17 AS builder
ENV GO111MODULE on
ENV CGO_ENABLED 0
ENV GOOS linux
ENV GOPROXY https://goproxy.io
ENV GOARCH amd64
WORKDIR /opt/ogrom.com/xiaohuazhu
COPY go.mod .
COPY go.sum .
RUN go mod tidy
COPY . /opt/ogrom.com/xiaohuazhu
RUN go build -a -installsuffix cgo -o /opt/ogrom.com/xiaohuazhu/cmd/main ./cmd/
# 第二阶段构建
FROM scratch
WORKDIR /opt/ogrom.com/xiaohuazhu
COPY --from=builder /opt/ogrom.com/xiaohuazhu .
# 暴露的 port
EXPOSE 8000
# 启动
ENTRYPOINT ["./cmd/main", "-f", "./config/"]
nohup ./xhz -f ./config/ &
[GIN-debug] Listening and serving HTTP on :8080
time="2022-04-25T18:40:18+08:00" level=info msg="初始化 db 成功"
time="2022-04-25T18:40:18+08:00" level=info msg="初始化 minio client 成功"
time="2022-04-25T18:40:18+08:00" level=info msg="程序启动中..."