Skip to content

Commit 6a7ed0a

Browse files
committed
first commit
0 parents  commit 6a7ed0a

File tree

27 files changed

+1347
-0
lines changed

27 files changed

+1347
-0
lines changed

.gitignore

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# If you prefer the allow list template instead of the deny list, see community template:
2+
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
3+
#
4+
# Binaries for programs and plugins
5+
*.exe
6+
*.exe~
7+
*.dll
8+
*.so
9+
*.dylib
10+
11+
# Test binary, built with `go test -c`
12+
*.test
13+
14+
# Output of the go coverage tool, specifically when used with LiteIDE
15+
*.out
16+
17+
# Dependency directories (remove the comment below to include it)
18+
# vendor/
19+
20+
# Go workspace file
21+
go.work
22+
go.work.sum
23+
24+
# env file
25+
.env
26+
**/__debug_*
27+
*.gone.go
28+
29+
bin/
30+
**/__debug_*

.idea/.gitignore

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/web.iml

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.vscode/launch.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
// 使用 IntelliSense 了解相关属性。
3+
// 悬停以查看现有属性的描述。
4+
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "server",
9+
"type": "go",
10+
"request": "launch",
11+
"mode": "auto",
12+
"program": "./cmd/server",
13+
"preLaunchTask": "generate"
14+
}
15+
]
16+
}

.vscode/settings.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"cSpell.words": [
3+
"gonectr",
4+
"GOFILE",
5+
"Dapeng",
6+
"Infof"
7+
]
8+
}

.vscode/tasks.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "generate",
6+
"type": "shell",
7+
"command": "go generate ./...",
8+
"problemMatcher": []
9+
}
10+
]
11+
}

Dockerfile

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
FROM golang:1.22-alpine3.19 as builder
2+
3+
4+
WORKDIR /app
5+
6+
ENV GO111MODULE=on \
7+
GOPROXY=https://goproxy.cn,direct
8+
9+
RUN sed 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' -i /etc/apk/repositories && \
10+
apk add git && \
11+
go install github.com/gone-io/gonectr@latest && \
12+
go install go.uber.org/mock/mockgen@latest
13+
14+
COPY ["go.mod", "go.sum", "Makefile", "./"]
15+
16+
RUN --mount=type=cache,target=/go,id=go go mod download
17+
18+
COPY cmd cmd
19+
COPY internal internal
20+
21+
#编译
22+
RUN --mount=type=cache,target=/go,id=go go generate ./... && \
23+
go build -ldflags="-w -s" -tags musl -o bin/server ./cmd/server
24+
25+
FROM alpine:3.19
26+
RUN sed 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' -i /etc/apk/repositories && \
27+
apk update && \
28+
apk add tzdata && \
29+
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
30+
echo "Asia/Shanghai" > /etc/timezone
31+
32+
WORKDIR /app
33+
COPY config config
34+
COPY assert assert
35+
COPY --from=builder /app/bin/server /app/server
36+
37+
ARG ENVIRONMENT=dev
38+
ENV ENV=${ENVIRONMENT}
39+
40+
CMD ./server
41+
EXPOSE 8080

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# web
2+
This is a demo web gone project.

cmd/server/main.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package main
2+
3+
import (
4+
"web/internal"
5+
6+
"github.com/gone-io/gone"
7+
)
8+
9+
func main() {
10+
gone.
11+
Default.
12+
LoadPriest(internal.Priest).
13+
Serve()
14+
}

0 commit comments

Comments
 (0)