From 39512df5de1396a355fca657f222b2d0b2e22722 Mon Sep 17 00:00:00 2001 From: jinql Date: Mon, 8 Sep 2025 00:31:24 +0800 Subject: [PATCH] 25.09.08 --- Dockerfile.1 | 16 ---------------- LICENSE | 19 +++++++++++++++++++ README.md | 45 +++++++++++++++++++++++++-------------------- conf/referrer.txt | 0 docker-compose.yml | 6 +++--- nginx.conf | 2 +- 6 files changed, 48 insertions(+), 40 deletions(-) delete mode 100644 Dockerfile.1 create mode 100644 LICENSE delete mode 100644 conf/referrer.txt diff --git a/Dockerfile.1 b/Dockerfile.1 deleted file mode 100644 index 5371c5a..0000000 --- a/Dockerfile.1 +++ /dev/null @@ -1,16 +0,0 @@ -FROM python:3.12-slim - -WORKDIR /app - -COPY requirements.txt . - -RUN pip install --no-cache-dir -r requirements.txt - -COPY . . - -EXPOSE 8000 - -# CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"] - -# CMD ["gunicorn", "-w", "4", "-k", "uvicorn.workers.UvicornWorker", "-b", "0.0.0.0:8000", "main:app"] -CMD ["gunicorn", "--config", "gunicorn.conf.py", "main:app"] diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..1627405 --- /dev/null +++ b/LICENSE @@ -0,0 +1,19 @@ +MIT License Copyright (c) 2025 xinac.com + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice (including the next +paragraph) shall be included in all copies or substantial portions of the +Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS +OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md index a1efe81..cf10688 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,32 @@ -# api_favicon +# favicon-api-v3 + +### 接口简介 - https://api.xinac.net/ -> python3 -m pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple +### 接口演示 -- 启动方式: - - python3 main.py 或 uwsgi --ini uwsgi.ini +- https://api.xinac.net/icon/ -- API使用 +### 使用方式 + +1. python3 -m pip install -r requirements.txt +2. python3 run.py + +### 生产使用 + +1. python3 -m pip install -r requirements.txt +2. chmod +x startup.sh && ./startup.sh + +> 生产环境使用仅支持Linux或Docker运行 + +### docker运行 + +1. docker pull xinac721/favicon-api-v3 +2. docker compose up -d + +> 自行构建:docker build -t favicon-api-v3:latest . + +### API使用 https://api.xinac.net/icon/?url=https://www.baidu.com - - -## 运行 - -- pip install fastapi uvicorn -- uvicorn main:app --reload --port 8081 - - -# 构建镜像(别忘了最后的 .) -docker build -t demo-app:latest . - -# 运行容器(-d 后台;-p 宿主机端口:容器端口) -docker run -d --name demo -p 8000:8000 demo-app:latest -- docker-compose up --build \ No newline at end of file diff --git a/conf/referrer.txt b/conf/referrer.txt deleted file mode 100644 index e69de29..0000000 diff --git a/docker-compose.yml b/docker-compose.yml index fbf0c9b..37021cd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ services: - favicon-api: - image: favicon-api:latest - container_name: favicon-api + favicon-api-v3: + image: favicon-api-v3:latest + container_name: favicon-api-v3 ports: - 8001:8000 environment: diff --git a/nginx.conf b/nginx.conf index fade996..2e55d0f 100644 --- a/nginx.conf +++ b/nginx.conf @@ -4,7 +4,7 @@ rewrite ^/icon/(.*)\.png$ /icon/?url=$1; # 反向代理配置 location /icon/ { - proxy_pass http://127.0.0.1:3136; + proxy_pass http://127.0.0.1:8001; proxy_http_version 1.1; ## Proxy headers