Spaces:
Paused
Paused
NtGdi commited on
Commit ·
71280f6
1
Parent(s): 3dad4b0
ci: add Docker image auto-build
Browse files- .dockerignore +34 -0
- .github/workflows/docker-image.yml +55 -0
- README.md +7 -8
.dockerignore
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Git files
|
| 2 |
+
.git
|
| 3 |
+
.github
|
| 4 |
+
.gitignore
|
| 5 |
+
|
| 6 |
+
# Environment files
|
| 7 |
+
.env
|
| 8 |
+
.env.*
|
| 9 |
+
!.env.example
|
| 10 |
+
|
| 11 |
+
# Build artifacts
|
| 12 |
+
*.exe
|
| 13 |
+
*.cmd
|
| 14 |
+
zai-proxy
|
| 15 |
+
|
| 16 |
+
# Documentation
|
| 17 |
+
README.md
|
| 18 |
+
*.md
|
| 19 |
+
|
| 20 |
+
# IDE and editor files
|
| 21 |
+
.vscode
|
| 22 |
+
.idea
|
| 23 |
+
*.swp
|
| 24 |
+
*.swo
|
| 25 |
+
*~
|
| 26 |
+
|
| 27 |
+
# OS files
|
| 28 |
+
.DS_Store
|
| 29 |
+
Thumbs.db
|
| 30 |
+
|
| 31 |
+
# Docker files
|
| 32 |
+
Dockerfile
|
| 33 |
+
.dockerignore
|
| 34 |
+
docker-compose.yml
|
.github/workflows/docker-image.yml
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Build and Publish Docker Image
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
push:
|
| 5 |
+
branches:
|
| 6 |
+
- main
|
| 7 |
+
tags:
|
| 8 |
+
- 'v*'
|
| 9 |
+
workflow_dispatch:
|
| 10 |
+
|
| 11 |
+
env:
|
| 12 |
+
REGISTRY: ghcr.io
|
| 13 |
+
IMAGE_NAME: ${{ github.repository }}
|
| 14 |
+
|
| 15 |
+
jobs:
|
| 16 |
+
build-and-push:
|
| 17 |
+
runs-on: ubuntu-latest
|
| 18 |
+
permissions:
|
| 19 |
+
contents: read
|
| 20 |
+
packages: write
|
| 21 |
+
|
| 22 |
+
steps:
|
| 23 |
+
- name: Checkout repository
|
| 24 |
+
uses: actions/checkout@v4
|
| 25 |
+
|
| 26 |
+
- name: Set up Docker Buildx
|
| 27 |
+
uses: docker/setup-buildx-action@v3
|
| 28 |
+
|
| 29 |
+
- name: Log in to Container Registry
|
| 30 |
+
uses: docker/login-action@v3
|
| 31 |
+
with:
|
| 32 |
+
registry: ${{ env.REGISTRY }}
|
| 33 |
+
username: ${{ github.actor }}
|
| 34 |
+
password: ${{ secrets.GITHUB_TOKEN }}
|
| 35 |
+
|
| 36 |
+
- name: Extract metadata
|
| 37 |
+
id: meta
|
| 38 |
+
uses: docker/metadata-action@v5
|
| 39 |
+
with:
|
| 40 |
+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
| 41 |
+
tags: |
|
| 42 |
+
type=raw,value=latest,enable={{is_default_branch}}
|
| 43 |
+
type=sha,prefix=,format=long
|
| 44 |
+
type=ref,event=tag
|
| 45 |
+
|
| 46 |
+
- name: Build and push Docker image
|
| 47 |
+
uses: docker/build-push-action@v5
|
| 48 |
+
with:
|
| 49 |
+
context: .
|
| 50 |
+
push: true
|
| 51 |
+
tags: ${{ steps.meta.outputs.tags }}
|
| 52 |
+
labels: ${{ steps.meta.outputs.labels }}
|
| 53 |
+
cache-from: type=gha
|
| 54 |
+
cache-to: type=gha,mode=max
|
| 55 |
+
platforms: linux/amd64,linux/arm64
|
README.md
CHANGED
|
@@ -29,17 +29,16 @@ go mod download
|
|
| 29 |
go run main.go
|
| 30 |
```
|
| 31 |
|
| 32 |
-
### Docker 部署
|
| 33 |
|
| 34 |
```bash
|
| 35 |
-
|
| 36 |
-
|
| 37 |
|
| 38 |
-
|
| 39 |
-
docker run -p 8000:8000 zai-proxy
|
| 40 |
|
| 41 |
-
|
| 42 |
-
docker run -p
|
| 43 |
```
|
| 44 |
|
| 45 |
## 环境变量
|
|
@@ -113,4 +112,4 @@ curl http://localhost:8000/v1/chat/completions \
|
|
| 113 |
|
| 114 |
### 支持的图片格式:
|
| 115 |
- HTTP/HTTPS URL
|
| 116 |
-
- Base64 编码 (data:image/jpeg;base64,...)
|
|
|
|
| 29 |
go run main.go
|
| 30 |
```
|
| 31 |
|
| 32 |
+
### Docker 一键部署
|
| 33 |
|
| 34 |
```bash
|
| 35 |
+
docker run -d -p 8000:8000 ghcr.io/kao0312/zai-proxy:latest
|
| 36 |
+
```
|
| 37 |
|
| 38 |
+
自定义端口和日志级别:
|
|
|
|
| 39 |
|
| 40 |
+
```bash
|
| 41 |
+
docker run -d -p 8080:8000 -e LOG_LEVEL=debug ghcr.io/kao0312/zai-proxy:latest
|
| 42 |
```
|
| 43 |
|
| 44 |
## 环境变量
|
|
|
|
| 112 |
|
| 113 |
### 支持的图片格式:
|
| 114 |
- HTTP/HTTPS URL
|
| 115 |
+
- Base64 编码 (data:image/jpeg;base64,...)
|