-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #94 from ch3nnn/v2
feat: v2.0.0
- Loading branch information
Showing
578 changed files
with
24,274 additions
and
40,806 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.git | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
* text=auto | ||
|
||
# Force the following filetypes to have unix eols, so Windows does not break them | ||
*.* text eol=lf | ||
|
||
# Windows forced line-endings | ||
/.idea/* text eol=crlf | ||
|
||
# | ||
## These files are binary and should be left untouched | ||
# | ||
|
||
# (binary is a macro for -text -diff) | ||
*.png binary |
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,102 +1,6 @@ | ||
### JetBrains template | ||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider | ||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 | ||
|
||
# User-specific stuff | ||
.idea/**/workspace.xml | ||
.idea/**/tasks.xml | ||
.idea/**/usage.statistics.xml | ||
.idea/**/dictionaries | ||
.idea/**/shelf | ||
|
||
# AWS User-specific | ||
.idea/**/aws.xml | ||
|
||
# Generated files | ||
.idea/**/contentModel.xml | ||
|
||
# Sensitive or high-churn files | ||
.idea/**/dataSources/ | ||
.idea/**/dataSources.ids | ||
.idea/**/dataSources.local.xml | ||
.idea/**/sqlDataSources.xml | ||
.idea/**/dynamic.xml | ||
.idea/**/uiDesigner.xml | ||
.idea/**/dbnavigator.xml | ||
|
||
# Gradle | ||
.idea/**/gradle.xml | ||
.idea/**/libraries | ||
|
||
# Gradle and Maven with auto-import | ||
# When using Gradle or Maven with auto-import, you should exclude module files, | ||
# since they will be recreated, and may cause churn. Uncomment if using | ||
# auto-import. | ||
# .idea/artifacts | ||
# .idea/compiler.xml | ||
# .idea/jarRepositories.xml | ||
# .idea/modules.xml | ||
# .idea/*.iml | ||
# .idea/modules | ||
# *.iml | ||
# *.ipr | ||
|
||
# CMake | ||
cmake-build-*/ | ||
|
||
# Mongo Explorer plugin | ||
.idea/**/mongoSettings.xml | ||
|
||
# File-based project format | ||
*.iws | ||
|
||
# IntelliJ | ||
out/ | ||
|
||
# mpeltonen/sbt-idea plugin | ||
.idea_modules/ | ||
|
||
# JIRA plugin | ||
atlassian-ide-plugin.xml | ||
|
||
# Cursive Clojure plugin | ||
.idea/replstate.xml | ||
|
||
# SonarLint plugin | ||
.idea/sonarlint/ | ||
|
||
# Crashlytics plugin (for Android Studio and IntelliJ) | ||
com_crashlytics_export_strings.xml | ||
crashlytics.properties | ||
crashlytics-build.properties | ||
fabric.properties | ||
|
||
# Editor-based Rest Client | ||
.idea/httpRequests | ||
|
||
# Android studio 3.1+ serialized cache file | ||
.idea/caches/build_file_checksums.ser | ||
|
||
### Go template | ||
# If you prefer the allow list template instead of the deny list, see community template: | ||
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore | ||
# | ||
# Binaries for programs and plugins | ||
*.exe | ||
*.exe~ | ||
*.dll | ||
*.so | ||
*.dylib | ||
|
||
# Test binary, built with `go test -c` | ||
*.test | ||
|
||
# Output of the go coverage tool, specifically when used with LiteIDE | ||
*.out | ||
|
||
# Dependency directories (remove the comment below to include it) | ||
# vendor/ | ||
|
||
# Go workspace file | ||
go.work | ||
|
||
bin/ | ||
storage/logs | ||
.idea | ||
*.log | ||
deploy/docker-compose/conf | ||
deploy/docker-compose/data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,32 @@ | ||
# FROM 基于 golang:1.20-alpine | ||
FROM golang:1.20-alpine AS builder | ||
FROM golang:1.22-alpine AS builder | ||
RUN set -eux && sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories | ||
|
||
# ENV 设置环境变量 | ||
ENV GO111MODULE=on | ||
ENV GOPROXY=https://goproxy.io,direct | ||
ARG APP_RELATIVE_PATH | ||
|
||
# COPY 源路径 目标路径 | ||
COPY . /go/src/github.com/ch3nnn/webstack-go | ||
COPY . /data/app | ||
WORKDIR /data/app | ||
|
||
# RUN 执行 go build . | ||
RUN cd /go/src/github.com/ch3nnn/webstack-go && go build . | ||
RUN rm -rf /data/app/bin/ | ||
RUN export GOPROXY=https://goproxy.cn,direct && go mod tidy && go build -ldflags="-s -w" -o ./bin/server ${APP_RELATIVE_PATH} | ||
RUN mv config /data/app/bin/ | ||
|
||
# FROM 基于 alpine:latest | ||
FROM alpine:latest | ||
|
||
# RUN 设置代理镜像 | ||
RUN echo -e http://mirrors.ustc.edu.cn/alpine/v3.13/main/ > /etc/apk/repositories | ||
FROM alpine:3.14 | ||
RUN set -eux && sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories | ||
|
||
# RUN 设置 Asia/Shanghai 时区 | ||
RUN apk --no-cache add tzdata && \ | ||
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \ | ||
echo "Asia/Shanghai" > /etc/timezone | ||
|
||
# COPY 源路径 目标路径 从镜像中 COPY | ||
COPY --from=builder /go/src/github.com/ch3nnn/webstack-go/webstack-go /opt/ | ||
RUN apk add tzdata && cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \ | ||
&& echo "Asia/Shanghai" > /etc/timezone \ | ||
&& apk del tzdata | ||
|
||
# EXPOSE 设置端口映射 | ||
EXPOSE 9999/tcp | ||
|
||
# WORKDIR 设置工作目录 | ||
WORKDIR /opt | ||
ARG APP_ENV | ||
ENV APP_ENV=${APP_ENV} | ||
|
||
# CMD 设置启动命令 | ||
CMD ["./webstack-go", "-env", "docker"] | ||
WORKDIR /data/app | ||
COPY --from=builder /data/app/bin /data/app | ||
COPY --from=builder /data/app/web/upload /data/app/web/upload/ | ||
RUN mkdir -p /data/app/storage/ | ||
|
||
EXPOSE 8000 | ||
ENTRYPOINT [ "./server" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
.PHONY: init | ||
init: | ||
go install github.com/google/wire/cmd/wire@latest | ||
go install github.com/swaggo/swag/cmd/swag@latest | ||
go install github.com/incu6us/goimports-reviser/v3@latest | ||
go install mvdan.cc/gofumpt@latest | ||
|
||
.PHONY: build | ||
build: | ||
go build -ldflags="-s -w" -o ./bin/server ./cmd/server | ||
|
||
.PHONY: docker | ||
docker: | ||
docker build -t webstack-go:v2 --build-arg APP_CONF=config/prod.yml --build-arg APP_RELATIVE_PATH=./cmd/server . | ||
docker run -itd -p 8000:8000 --name webstack-go webstack-go:v2 | ||
|
||
.PHONY: swag | ||
swag: | ||
swag init -g cmd/server/main.go -o ./docs --parseDependency | ||
|
||
.PHONY: fmt | ||
fmt: | ||
goimports-reviser -rm-unused -set-alias -format ./... | ||
find . -name '*.go' -not -name "*.pb.go" -not -name "*.gen.go" | xargs gofumpt -w -extra | ||
|
||
.PHONY: run | ||
run: | ||
go mod tidy | ||
go build -ldflags="-s -w" -o ./bin/server ./cmd/server | ||
./bin/server -conf=config/prod.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.