diff --git a/.gitattributes b/.gitattributes index 24a8e87..f943c01 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1,2 @@ *.png filter=lfs diff=lfs merge=lfs -text +yolo-doclaynet.pt filter=lfs diff=lfs merge=lfs -text diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 0000000..0b2bce7 --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,34 @@ +name: Publish Docker image + +on: + release: + types: [published] + +jobs: + push_to_registry: + name: Push Docker image to Docker Hub + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v4 + + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ppaanngggg/yolo-doclaynet + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + file: ./Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/Dockerfile b/Dockerfile index eef3467..fea6288 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,9 @@ -FROM ultralytics/ultralytics:8.2.16-cpu +FROM ultralytics/ultralytics:8.2.48-cpu WORKDIR /app -RUN pip install fastapi uvicorn pydantic_settings loguru -i https://pypi.tuna.tsinghua.edu.cn/simple +RUN pip install fastapi uvicorn pydantic_settings loguru +ADD yolo-doclaynet.pt /app/yolo-doclaynet.pt ADD main.py /app/main.py -ADD yolov8n-doclaynet.pt /app/yolov8n-doclaynet.pt CMD ["python", "main.py"] \ No newline at end of file diff --git a/main.py b/main.py index 2dbeac2..9585271 100644 --- a/main.py +++ b/main.py @@ -11,7 +11,7 @@ class Conf(BaseSettings): - model_path: str = Field(default="yolov8n-doclaynet.pt", description="Model path") + model_path: str = Field(default="yolo-doclaynet.pt", description="Model path") max_connections: int = Field( default=10, description="Maximum number of connections" ) diff --git a/yolo-doclaynet.pt b/yolo-doclaynet.pt new file mode 100644 index 0000000..acbf3cd --- /dev/null +++ b/yolo-doclaynet.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5c8ccb87e5c6cf32d00338107b8e9de8a398cde26b3d02247bd1c534a2c28a01 +size 55111