Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ miniapp2api.exe
# 本機執行資料(含密碼雜湊、API 金鑰、帳號 JWT/CSRF)
config.json
auths/
bin/*

# 日誌與暫存
*.log
Expand Down
9 changes: 9 additions & 0 deletions README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Pure Go, no third-party dependencies, and a single self-contained binary (Window
- [Windows](#windows)
- [Linux](#linux)
- [Build from source](#build-from-source)
- [Auto build](#auto-build)
- [First run](#first-run)
- [Adding accounts](#adding-accounts)
- [Calling the OpenAI API](#calling-the-openai-api)
Expand Down Expand Up @@ -184,6 +185,14 @@ GOOS=windows GOARCH=amd64 go build -o miniapp2api.exe .
GOOS=linux GOARCH=arm64 go build -o miniapp2api-linux-arm64 .
```

### Auto build

`build/build-windows.bat` Windows builder

`build/build-linux.bat` Linux environment builder

`bin/` Build result

### Command-line flags

| Flag | Description |
Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
- [Windows](#windows)
- [Linux](#linux)
- [從原始碼建置](#從原始碼建置)
- [自動建置](#自動建置)
- [第一次啟動](#第一次啟動)
- [新增帳號](#新增帳號)
- [呼叫 OpenAI API](#呼叫-openai-api)
Expand Down Expand Up @@ -185,6 +186,14 @@ GOOS=windows GOARCH=amd64 go build -o miniapp2api.exe .
GOOS=linux GOARCH=arm64 go build -o miniapp2api-linux-arm64 .
```

### 自動建置

`build/build-windows.bat`提供windows編譯

`build/build-linux.bat`提供Linux編譯環境

`bin/`儲存編譯的結果

### 命令列參數

| 參數 | 說明 |
Expand Down
26 changes: 26 additions & 0 deletions build/build-linux.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
@echo off
set APP_NAME=app

echo [Info] start building app

set GOOS=linux
set GOARCH=amd64
set CGO_ENABLED=0

go version
if %errorlevel% neq 0 (
echo [Error] failed to find go. Please install Go or check PATH.
exit /b %errorlevel%
)

if not exist ..\bin (mkdir ..\bin & echo [Info] create ../bin)

@REM go build -ldflags="-s -w" -o ../bin/%APP_NAME%_linux_amd64 ../cmd/server
go build -o ../bin/%APP_NAME%_linux_amd64 ../cmd/server
if %errorlevel% neq 0 (
echo [Error] failed to build
exit /b %errorlevel%
)
echo [Success] output at ../bin/%APP_NAME%_linux_amd64

pause
24 changes: 24 additions & 0 deletions build/build-windows.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
@echo off
set APP_NAME=app

echo [Info] start building app

set GOOS=windows
set GOARCH=amd64

go version
if %errorlevel% neq 0 (
echo [Error] failed to find go. Please install Go or check PATH.
exit /b %errorlevel%
)

if not exist ..\bin (mkdir ..\bin & echo [Info] create ../bin)

go build -o ..\bin\%APP_NAME%_windows_amd64.exe ..\cmd\server
if %errorlevel% neq 0 (
echo [Error] failed to build
exit /b %errorlevel%
)
echo [Success] output at ..\bin\%APP_NAME%_windows_amd64

pause
File renamed without changes.