feat:增加docker部署
This commit is contained in:
14
.env
14
.env
@@ -1,14 +0,0 @@
|
||||
RUSTFS_ENDPOINT=http://114.66.28.183:42736
|
||||
RUSTFS_ACCESS_KEY=B4K79q5HGhPJlnXfLs20
|
||||
RUSTFS_SECRET_KEY=j9b3M2LRU80okVcZnBOxePvd7NXF5TSrqf6gImA1
|
||||
RUSTFS_BUCKET=study
|
||||
|
||||
OCR_API_URL=https://paddleocr.aistudio-app.com/api/v2/ocr/jobs
|
||||
OCR_API_TOKEN=df7dcc85a5c3c9d64e421f353d11d13ec45512f6
|
||||
OCR_MODEL=PaddleOCR-VL-1.6
|
||||
|
||||
MODEL_NAME="glm-5.2"
|
||||
MODEL_BASE_URL="https://dashscope.aliyuncs.com/compatible-mode/v1"
|
||||
MODEL_API_KEY="sk-52bcd98e9c1d45908437c4e8706eefff"
|
||||
|
||||
DATABASE_URL=postgresql+asyncpg://agent:medical%402019@60.247.145.200:5432/study
|
||||
11
Dockerfile
Normal file
11
Dockerfile
Normal file
@@ -0,0 +1,11 @@
|
||||
FROM python:3.12-slim
|
||||
WORKDIR /app
|
||||
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
|
||||
RUN echo 'Asia/Shanghai' > /etc/timezone
|
||||
COPY ./packages /app/packages
|
||||
COPY requirements.txt /app/
|
||||
RUN pip install --no-cache-dir --no-index --find-links=/app/packages -r requirements.txt
|
||||
COPY . /app/
|
||||
EXPOSE 8000
|
||||
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||
# pip download -r requirements.txt -d ./packages --only-binary=:all: --platform manylinux2014_x86_64 -i https://pypi.tuna.tsinghua.edu.cn/simple
|
||||
6
main.py
6
main.py
@@ -1,6 +1,6 @@
|
||||
from typing import List
|
||||
|
||||
from fastapi import FastAPI, UploadFile, File, Depends
|
||||
from fastapi import FastAPI, UploadFile, File, Depends, Form
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
from starlette.middleware.cors import CORSMiddleware
|
||||
from starlette.responses import StreamingResponse
|
||||
@@ -26,8 +26,8 @@ app.add_middleware(
|
||||
|
||||
|
||||
@app.post("/library/upload")
|
||||
def upload(file: UploadFile = File(...)):
|
||||
url = upload_rustfs(file.file, file.filename)
|
||||
def upload(file: UploadFile = File(...), filename: str = Form(...)):
|
||||
url = upload_rustfs(file.file, filename)
|
||||
return ocr_from_url(url)
|
||||
|
||||
|
||||
|
||||
@@ -9,4 +9,6 @@ langchain-openai~=1.4.1
|
||||
starlette~=1.3.1
|
||||
pydantic~=2.13.4
|
||||
SQLAlchemy~=2.0.51
|
||||
asyncpg~=0.31.0
|
||||
asyncpg~=0.30.0
|
||||
uvicorn~=0.23.0
|
||||
python-multipart~=0.0.32
|
||||
Reference in New Issue
Block a user