Skip to content

Commit

Permalink
feat: Support docker deploy and fix requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
wengchaoxi committed Mar 28, 2024
1 parent 0847cb9 commit 4e41570
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 13 deletions.
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
__pycache__/
images/

.env
Dockerfile
docker-compose.yml
README.md
File renamed without changes.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ pip-selfcheck.json
*.iml
out
gen

__pycache__
.env
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# syntax=docker/dockerfile:1
FROM python:3.10-slim-buster

WORKDIR /app

COPY requirements.txt ./
RUN --mount=type=cache,target=/root/.cache/pip \
pip install -r requirements.txt --no-cache-dir

COPY . .

EXPOSE 8000
CMD [ "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000" ]
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,34 @@ It comes with a built-in token maintenance and keep-alive feature, so you don't

#### Configuration

Edit the .env file and fill in the session_id and cookie.
Edit the `.env.example` file, rename to `.env` and fill in the session_id and cookie.

These are initially obtained from the browser, and will be automatically kept alive later.

![cookie](./images/cover.png)


#### Install dependencies
#### Run

Install dependencies

```bash
pip3 install -r requirements.txt
```

#### Run

For this part, refer to the FastAPI documentation on your own.
```bash
uvicorn main:app
```

#### Docker

```bash
docker compose build && docker compose up
```

#### Documentation

After setting up the service, visit /docs

![docs](./images/docs.png)
![docs](./images/docs.png)
16 changes: 10 additions & 6 deletions README_ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,34 @@

#### 配置

编辑 .env 文件,填写 session_id 和 cookie
编辑 `.env.example` 文件,重命名为 `.env`,填写 session_id 和 cookie

这些先从浏览器中获取,后期会自动保活。

![cookie](./images/cover.png)

#### 安装依赖
#### 运行

安装依赖

```bash
pip3 install -r requirements.txt
```

#### 运行

这一部分,自行参考 FastAPI 文档

```bash
uvicorn main:app
```

#### Docker

```bash
docker compose build && docker compose up
```

#### 文档

搭建服务后访问 /docs

![docs](./images/docs.png)


9 changes: 9 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: '3'

services:
suno-api:
build: .
ports:
- "8000:8000"
env_file:
- .env
5 changes: 3 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
aiohttp
dotenv
python-dotenv
fastapi
uvicorn
pydantic
pydantic
requests

0 comments on commit 4e41570

Please sign in to comment.