feat: 新增docker

This commit is contained in:
gaze 2025-04-25 13:11:16 +08:00
parent 60e32707c0
commit d5348c381b
7 changed files with 55 additions and 1 deletions

3
.dockerignore Normal file
View File

@ -0,0 +1,3 @@
LICENSE
README.md
.gitignore

8
.env Normal file
View File

@ -0,0 +1,8 @@
# 对应命令行参数的 level
LEVEL=lossless
# 对应命令行参数的 level
MODE=api
# 对应命令行参数的 url
URL=http://127.0.0.1:5000

10
Dockerfile Normal file
View File

@ -0,0 +1,10 @@
FROM python:3.9.22-alpine3.21
WORKDIR /app
COPY requirements.txt requirements.txt
RUN pip3 config set global.index-url https://mirrors.aliyun.com/pypi/simple/ && \
pip3 install --no-cache-dir -r requirements.txt
COPY . .
RUN chmod +x /app/entrypoint.sh
ENV TZ=Asia/Shanghai
EXPOSE 5000
CMD ["/app/entrypoint.sh"]

View File

@ -31,6 +31,27 @@ python main.py
| level | 音质参数(请看下方音质说明) | | level | 音质参数(请看下方音质说明) |
| type | 解析类型 json down text *任选其一 | | type | 解析类型 json down text *任选其一 |
# docker-compose一键部署
## 修改参数
部署前,可以根据需要修改`.env`文件中的环境变量
默认端口为`5000`,如果需要修改,请在`docker-compose.yml`文件中修改`ports`变量
例如,如果需要将端口修改为`8080`,请将以下代码:
```yaml
ports:
- "8080:5000"
```
## docker-compose一键启动
```bash
docker-compose up -d
```
# 音质说明 # 音质说明
standard(标准音质), exhigh(极高音质), lossless(无损音质), hires(Hi-Res音质), jyeffect(高清环绕声), sky(沉浸环绕声), jymaster(超清母带) standard(标准音质), exhigh(极高音质), lossless(无损音质), hires(Hi-Res音质), jyeffect(高清环绕声), sky(沉浸环绕声), jymaster(超清母带)

10
docker-compose.yml Normal file
View File

@ -0,0 +1,10 @@
services:
netease-url:
build:
context: .
dockerfile: Dockerfile
env_file:
- .env
ports:
- "5000:5000"
restart: unless-stopped

2
entrypoint.sh Normal file
View File

@ -0,0 +1,2 @@
#!/bin/sh
python3 main.py --level "${LEVEL:-lossless}" --mode "${MODE:-api}" --url "${URL:-''}"