From b56e30dabb875ecea44f6029ccdd9f9f0db187ea Mon Sep 17 00:00:00 2001 From: Gaze Date: Fri, 28 Jul 2023 12:53:34 +0800 Subject: [PATCH] feat: add dockerfike --- .gitignore | 3 ++ .idea/.gitignore | 8 ----- .idea/inspectionProfiles/Project_Default.xml | 12 ------- .../inspectionProfiles/profiles_settings.xml | 6 ---- .idea/misc.xml | 4 --- .idea/modules.xml | 8 ----- .idea/music_tool.iml | 8 ----- .idea/vcs.xml | 6 ---- Dockerfile | 7 ++++ api.py | 4 ++- requirements.txt | 34 +++++++++++++++++-- 11 files changed, 45 insertions(+), 55 deletions(-) create mode 100644 .gitignore delete mode 100644 .idea/.gitignore delete mode 100644 .idea/inspectionProfiles/Project_Default.xml delete mode 100644 .idea/inspectionProfiles/profiles_settings.xml delete mode 100644 .idea/misc.xml delete mode 100644 .idea/modules.xml delete mode 100644 .idea/music_tool.iml delete mode 100644 .idea/vcs.xml create mode 100644 Dockerfile diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8f70d67 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.idea +venv +__pycache__ \ No newline at end of file diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 7311359..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -# 默认忽略的文件 -/shelf/ -/workspace.xml -# 基于编辑器的 HTTP 客户端请求 -/httpRequests/ -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml deleted file mode 100644 index 06bb031..0000000 --- a/.idea/inspectionProfiles/Project_Default.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml deleted file mode 100644 index 105ce2d..0000000 --- a/.idea/inspectionProfiles/profiles_settings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index c95d785..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 62aa038..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/music_tool.iml b/.idea/music_tool.iml deleted file mode 100644 index 8b74d97..0000000 --- a/.idea/music_tool.iml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 94a25f7..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..219dc02 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.10.11-slim-buster +WORKDIR /app +COPY . . +RUN pip3 config set global.index-url https://mirrors.aliyun.com/pypi/simple/ +RUN pip3 install -r requirements.txt +EXPOSE 7788 +CMD ["python3", "api.py"] \ No newline at end of file diff --git a/api.py b/api.py index 498c37b..6baa07e 100644 --- a/api.py +++ b/api.py @@ -57,6 +57,7 @@ async def search_song_by_name( print(f"Failed to get data. Status code: {response.status_code}") return {"message": "failed", "data": []} + # 根据歌曲id搜索歌曲 @app.get("/search_song_by_id") async def search_song_by_id( @@ -97,7 +98,8 @@ async def search_song_by_id( print(f"Failed to get data. Status code: {response.status_code}") return {"message": "failed", "data": []} + if __name__ == '__main__': host = env.get("HOST") if env.get("HOST") is not None else "0.0.0.0" port = int(env.get("PORT")) if env.get("PORT") is not None else 7788 - uvicorn.run(app='api:app', host=host, port=port, reload=True) \ No newline at end of file + uvicorn.run(app='api:app', host=host, port=port, reload=True) diff --git a/requirements.txt b/requirements.txt index 8dab154..c5a9455 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,34 @@ +annotated-types==0.5.0 +anyio==3.7.1 +appdirs==1.4.4 +beautifulsoup4==4.12.2 +bs4==0.0.1 +certifi==2023.7.22 +charset-normalizer==3.2.0 +click==8.1.6 +cssselect==1.2.0 +exceptiongroup==1.1.2 +fake-useragent==1.1.3 fastapi==0.100.0 -Requests==2.31.0 -requests_html==0.10.0 +h11==0.14.0 +idna==3.4 +importlib-metadata==6.8.0 +lxml==4.9.3 +parse==1.19.1 +pydantic==2.1.1 +pydantic_core==2.4.0 +pyee==8.2.2 +pyppeteer==1.0.2 +pyquery==2.0.0 +requests==2.31.0 +requests-html==0.10.0 +sniffio==1.3.0 +soupsieve==2.4.1 +starlette==0.27.0 +tqdm==4.65.0 +typing_extensions==4.7.1 +urllib3==1.26.16 uvicorn==0.20.0 +w3lib==2.1.1 +websockets==10.4 +zipp==3.16.2