diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..e328e5b --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +LICENSE +README.md +.gitignore diff --git a/.env b/.env new file mode 100644 index 0000000..8434d0d --- /dev/null +++ b/.env @@ -0,0 +1,8 @@ +# 对应命令行参数的 level +LEVEL=lossless + +# 对应命令行参数的 level +MODE=api + +# 对应命令行参数的 url +URL=http://127.0.0.1:5000 diff --git a/.gitignore b/.gitignore index 4f161e4..1887ae9 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,4 @@ venv __pycache__ *.pyc *.pyo -*.pyd \ No newline at end of file +*.pyd diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a5c7f04 --- /dev/null +++ b/Dockerfile @@ -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"] diff --git a/README.md b/README.md index 099ff5b..9350afc 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,27 @@ python main.py | level | 音质参数(请看下方音质说明) | | 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(超清母带) diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..7368b1c --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,10 @@ +services: + netease-url: + build: + context: . + dockerfile: Dockerfile + env_file: + - .env + ports: + - "5000:5000" + restart: unless-stopped diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..e039143 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,2 @@ +#!/bin/sh +python3 main.py --level "${LEVEL:-lossless}" --mode "${MODE:-api}" --url "${URL:-''}"