diff --git a/.github/workflows/docker-image-amd64.yml b/.github/workflows/docker-image-amd64.yml index 1a77775c..e3b8439a 100644 --- a/.github/workflows/docker-image-amd64.yml +++ b/.github/workflows/docker-image-amd64.yml @@ -42,7 +42,7 @@ jobs: uses: docker/metadata-action@v4 with: images: | - justsong/gin-template + justsong/one-api ghcr.io/${{ github.repository }} - name: Build and push Docker images diff --git a/.github/workflows/docker-image-arm64.yml b/.github/workflows/docker-image-arm64.yml index 5ffd1555..7304e5c9 100644 --- a/.github/workflows/docker-image-arm64.yml +++ b/.github/workflows/docker-image-arm64.yml @@ -48,7 +48,7 @@ jobs: uses: docker/metadata-action@v4 with: images: | - justsong/gin-template + justsong/one-api ghcr.io/${{ github.repository }} - name: Build and push Docker images diff --git a/.github/workflows/linux-release.yml b/.github/workflows/linux-release.yml index ac84675d..2696fbfb 100644 --- a/.github/workflows/linux-release.yml +++ b/.github/workflows/linux-release.yml @@ -30,20 +30,20 @@ jobs: - name: Build Backend (amd64) run: | go mod download - go build -ldflags "-s -w -X 'gin-template/common.Version=$(git describe --tags)' -extldflags '-static'" -o gin-template + go build -ldflags "-s -w -X 'one-api/common.Version=$(git describe --tags)' -extldflags '-static'" -o one-api - name: Build Backend (arm64) run: | sudo apt-get update sudo apt-get install gcc-aarch64-linux-gnu - CC=aarch64-linux-gnu-gcc CGO_ENABLED=1 GOOS=linux GOARCH=arm64 go build -ldflags "-s -w -X 'gin-template/common.Version=$(git describe --tags)' -extldflags '-static'" -o gin-template-arm64 + CC=aarch64-linux-gnu-gcc CGO_ENABLED=1 GOOS=linux GOARCH=arm64 go build -ldflags "-s -w -X 'one-api/common.Version=$(git describe --tags)' -extldflags '-static'" -o one-api-arm64 - name: Release uses: softprops/action-gh-release@v1 if: startsWith(github.ref, 'refs/tags/') with: files: | - gin-template - gin-template-arm64 + one-api + one-api-arm64 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/macos-release.yml b/.github/workflows/macos-release.yml index 39850d86..7f4e48b1 100644 --- a/.github/workflows/macos-release.yml +++ b/.github/workflows/macos-release.yml @@ -30,11 +30,11 @@ jobs: - name: Build Backend run: | go mod download - go build -ldflags "-X 'gin-template/common.Version=$(git describe --tags)'" -o gin-template-macos + go build -ldflags "-X 'one-api/common.Version=$(git describe --tags)'" -o one-api-macos - name: Release uses: softprops/action-gh-release@v1 if: startsWith(github.ref, 'refs/tags/') with: - files: gin-template-macos + files: one-api-macos env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/windows-release.yml b/.github/workflows/windows-release.yml index e9877f87..525f0524 100644 --- a/.github/workflows/windows-release.yml +++ b/.github/workflows/windows-release.yml @@ -33,11 +33,11 @@ jobs: - name: Build Backend run: | go mod download - go build -ldflags "-s -w -X 'gin-template/common.Version=$(git describe --tags)'" -o gin-template.exe + go build -ldflags "-s -w -X 'one-api/common.Version=$(git describe --tags)'" -o one-api.exe - name: Release uses: softprops/action-gh-release@v1 if: startsWith(github.ref, 'refs/tags/') with: - files: gin-template.exe + files: one-api.exe env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 7b2dc9ae..a8df7683 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,7 +16,7 @@ WORKDIR /build COPY . . COPY --from=builder /build/build ./web/build RUN go mod download -RUN go build -ldflags "-s -w -X 'gin-template/common.Version=$(cat VERSION)' -extldflags '-static'" -o gin-template +RUN go build -ldflags "-s -w -X 'one-api/common.Version=$(cat VERSION)' -extldflags '-static'" -o one-api FROM alpine @@ -25,7 +25,7 @@ RUN apk update \ && apk add --no-cache ca-certificates tzdata \ && update-ca-certificates 2>/dev/null || true ENV PORT=3000 -COPY --from=builder2 /build/gin-template / +COPY --from=builder2 /build/one-api / EXPOSE 3000 WORKDIR /data -ENTRYPOINT ["/gin-template"] +ENTRYPOINT ["/one-api"] diff --git a/README.en.md b/README.en.md index eb98bc16..7387244e 100644 --- a/README.en.md +++ b/README.en.md @@ -3,7 +3,7 @@
- Download + Download · - Tutorial + Tutorial · - Feedback + Feedback · - Demo + Demo
## Features @@ -54,23 +54,23 @@ _✨ Template for Gin & React projects ✨_ ## Deployment ### Manual deployment -1. Download built binary from [GitHub Releases](https://github.com/songquanpeng/gin-template/releases/latest) or build from source: +1. Download built binary from [GitHub Releases](https://github.com/songquanpeng/one-api/releases/latest) or build from source: ```shell - git clone https://github.com/songquanpeng/gin-template.git + git clone https://github.com/songquanpeng/one-api.git go mod download - go build -ldflags "-s -w" -o gin-template + go build -ldflags "-s -w" -o one-api ```` 2. Run it: ```shell - chmod u+x gin-template - ./gin-template --port 3000 --log-dir ./logs + chmod u+x one-api + ./one-api --port 3000 --log-dir ./logs ``` 3. Visit [http://localhost:3000/](http://localhost:3000/) and login. The username for the initial account is `root` and the password is `123456`. ### Deploy with Docker -Execute: `docker run -d --restart always -p 3000:3000 -v /home/ubuntu/data/gin-template:/data -v /etc/ssl/certs:/etc/ssl/certs:ro justsong/gin-template` +Execute: `docker run -d --restart always -p 3000:3000 -v /home/ubuntu/data/one-api:/data -v /etc/ssl/certs:/etc/ssl/certs:ro justsong/one-api` -Data will be saved in `/home/ubuntu/data/gin-template`. +Data will be saved in `/home/ubuntu/data/one-api`. ## Configurations The system works out of the box. @@ -85,7 +85,7 @@ After the system starts, use `root` user to log in to the system and do further 2. `SESSION_SECRET`: when set, a fixed session key will be used so that the logged-in users' cookie remains valid across system reboots. + Example: `SESSION_SECRET=random_string` 3. `SQL_DSN`: when set, the target SQL database will be used instead of SQLite. - + Example: `SQL_DSN=root:123456@tcp(localhost:3306)/gin-template` + + Example: `SQL_DSN=root:123456@tcp(localhost:3306)/one-api` ### Command line Arguments 1. `--port
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
- 程序下载 + 程序下载 · - 部署教程 + 部署教程 · - 意见反馈 + 意见反馈 · - 在线演示 + 在线演示
## 功能 @@ -54,25 +54,25 @@ _✨ 用于 Gin & React 项目的模板 ✨_ ## 部署 ### 手动部署 -1. 从 [GitHub Releases](https://github.com/songquanpeng/gin-template/releases/latest) 下载可执行文件或者从源码编译: +1. 从 [GitHub Releases](https://github.com/songquanpeng/one-api/releases/latest) 下载可执行文件或者从源码编译: ```shell - git clone https://github.com/songquanpeng/gin-template.git + git clone https://github.com/songquanpeng/one-api.git go mod download - go build -ldflags "-s -w" -o gin-template + go build -ldflags "-s -w" -o one-api ```` 2. 运行: ```shell - chmod u+x gin-template - ./gin-template --port 3000 --log-dir ./logs + chmod u+x one-api + ./one-api --port 3000 --log-dir ./logs ``` 3. 访问 [http://localhost:3000/](http://localhost:3000/) 并登录。初始账号用户名为 `root`,密码为 `123456`。 更加详细的部署教程[参见此处](https://iamazing.cn/page/how-to-deploy-a-website)。 ### 基于 Docker 进行部署 -执行:`docker run -d --restart always -p 3000:3000 -v /home/ubuntu/data/gin-template:/data -v /etc/ssl/certs:/etc/ssl/certs:ro justsong/gin-template` +执行:`docker run -d --restart always -p 3000:3000 -v /home/ubuntu/data/one-api:/data -v /etc/ssl/certs:/etc/ssl/certs:ro justsong/one-api` -数据将会保存在宿主机的 `/home/ubuntu/data/gin-template` 目录。 +数据将会保存在宿主机的 `/home/ubuntu/data/one-api` 目录。 ## 配置 系统本身开箱即用。 @@ -87,7 +87,7 @@ _✨ 用于 Gin & React 项目的模板 ✨_ 2. `SESSION_SECRET`:设置之后将使用固定的会话密钥,这样系统重新启动后已登录用户的 cookie 将依旧有效。 + 例子:`SESSION_SECRET=random_string` 3. `SQL_DSN`:设置之后将使用指定数据库而非 SQLite。 - + 例子:`SQL_DSN=root:123456@tcp(localhost:3306)/gin-template` + + 例子:`SQL_DSN=root:123456@tcp(localhost:3306)/one-api` ### 命令行参数 1. `--port