feat: add dockerfike
This commit is contained in:
parent
004d0b2917
commit
b56e30dabb
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
.idea
|
||||||
|
venv
|
||||||
|
__pycache__
|
8
.idea/.gitignore
generated
vendored
8
.idea/.gitignore
generated
vendored
@ -1,8 +0,0 @@
|
|||||||
# 默认忽略的文件
|
|
||||||
/shelf/
|
|
||||||
/workspace.xml
|
|
||||||
# 基于编辑器的 HTTP 客户端请求
|
|
||||||
/httpRequests/
|
|
||||||
# Datasource local storage ignored files
|
|
||||||
/dataSources/
|
|
||||||
/dataSources.local.xml
|
|
12
.idea/inspectionProfiles/Project_Default.xml
generated
12
.idea/inspectionProfiles/Project_Default.xml
generated
@ -1,12 +0,0 @@
|
|||||||
<component name="InspectionProjectProfileManager">
|
|
||||||
<profile version="1.0">
|
|
||||||
<option name="myName" value="Project Default" />
|
|
||||||
<inspection_tool class="PyPep8NamingInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
|
|
||||||
<option name="ignoredErrors">
|
|
||||||
<list>
|
|
||||||
<option value="N802" />
|
|
||||||
</list>
|
|
||||||
</option>
|
|
||||||
</inspection_tool>
|
|
||||||
</profile>
|
|
||||||
</component>
|
|
6
.idea/inspectionProfiles/profiles_settings.xml
generated
6
.idea/inspectionProfiles/profiles_settings.xml
generated
@ -1,6 +0,0 @@
|
|||||||
<component name="InspectionProjectProfileManager">
|
|
||||||
<settings>
|
|
||||||
<option name="USE_PROJECT_PROFILE" value="false" />
|
|
||||||
<version value="1.0" />
|
|
||||||
</settings>
|
|
||||||
</component>
|
|
4
.idea/misc.xml
generated
4
.idea/misc.xml
generated
@ -1,4 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ProjectRootManager" version="2" project-jdk-name="py39" project-jdk-type="Python SDK" />
|
|
||||||
</project>
|
|
8
.idea/modules.xml
generated
8
.idea/modules.xml
generated
@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ProjectModuleManager">
|
|
||||||
<modules>
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/.idea/music_tool.iml" filepath="$PROJECT_DIR$/.idea/music_tool.iml" />
|
|
||||||
</modules>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
8
.idea/music_tool.iml
generated
8
.idea/music_tool.iml
generated
@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module type="PYTHON_MODULE" version="4">
|
|
||||||
<component name="NewModuleRootManager">
|
|
||||||
<content url="file://$MODULE_DIR$" />
|
|
||||||
<orderEntry type="jdk" jdkName="py39" jdkType="Python SDK" />
|
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
|
||||||
</component>
|
|
||||||
</module>
|
|
6
.idea/vcs.xml
generated
6
.idea/vcs.xml
generated
@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="VcsDirectoryMappings">
|
|
||||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
7
Dockerfile
Normal file
7
Dockerfile
Normal file
@ -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"]
|
4
api.py
4
api.py
@ -57,6 +57,7 @@ async def search_song_by_name(
|
|||||||
print(f"Failed to get data. Status code: {response.status_code}")
|
print(f"Failed to get data. Status code: {response.status_code}")
|
||||||
return {"message": "failed", "data": []}
|
return {"message": "failed", "data": []}
|
||||||
|
|
||||||
|
|
||||||
# 根据歌曲id搜索歌曲
|
# 根据歌曲id搜索歌曲
|
||||||
@app.get("/search_song_by_id")
|
@app.get("/search_song_by_id")
|
||||||
async def 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}")
|
print(f"Failed to get data. Status code: {response.status_code}")
|
||||||
return {"message": "failed", "data": []}
|
return {"message": "failed", "data": []}
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
host = env.get("HOST") if env.get("HOST") is not None else "0.0.0.0"
|
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
|
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)
|
uvicorn.run(app='api:app', host=host, port=port, reload=True)
|
||||||
|
@ -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
|
fastapi==0.100.0
|
||||||
Requests==2.31.0
|
h11==0.14.0
|
||||||
requests_html==0.10.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
|
uvicorn==0.20.0
|
||||||
|
w3lib==2.1.1
|
||||||
|
websockets==10.4
|
||||||
|
zipp==3.16.2
|
||||||
|
Loading…
Reference in New Issue
Block a user